【发布时间】:2018-06-25 15:41:17
【问题描述】:
UITableViewCell 未在此弹出菜单中显示“删除”选项。它转到下面代码中的删除条件,但它没有显示在菜单中。
func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
print(action)
print(action == #selector(delete(_:)))
if action == #selector(copy(_:)) {
return true
}
if action == #selector(paste(_:)) {
return true
}
if action == #selector(delete(_:)) {
return true
}
return super.canPerformAction(action, withSender: sender)
}
【问题讨论】:
-
print(action)打印出更多(总共 20 个,包括删除、复制和粘贴)操作,您有什么理由专门询问“删除”吗? -
我必须实现删除行功能。但它没有出现在菜单中
标签: ios swift uitableview uitableviewrowaction