【发布时间】:2020-09-02 03:05:41
【问题描述】:
谁能解释一下如何解决这个问题?
这是它现在在 iPhone X (iOS 12.4) 上显示的内容
下面是我的代码
@available(iOS 11.0, *)
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
guard let account = accounts?[indexPath.row] else { return nil }
getAndSetAmountConstraint(from: account)
let editAction = UIContextualAction(style: .normal, title: nil) { [weak self] (_, _, completionHandler) in
self?.showEditAlertViewWith(account: account)
completionHandler(true)
}
let deleteAction = UIContextualAction(style: .normal, title: nil) { [weak self] (_, _, completionHandler) in
self?.removeRow(at: indexPath)
completionHandler(true)
}
editAction.image = UIImage(named: "edit")
deleteAction.image = UIImage(named: "delete")
editAction.backgroundColor = .lightGray
deleteAction.backgroundColor = .lightGray
let actions = UISwipeActionsConfiguration(actions: [deleteAction, editAction])
return actions
}
【问题讨论】:
标签: ios swift image uicontextualaction