我有一个UITableView的单元格,从右向左滑动时已经实现了两个自定义按钮(UITableViewRowAction编辑操作)。一切运作良好。UITableViewCell“全”滑动,从右到左
我想在用户滑动“一路”(也是从右到左)时触发其中一个按钮的动作,类似于Mail.app。
代码是斯威夫特3,适用于iOS 9和10
我有什么,我认为是已具备足够的代码。
func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
return .delete
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
print("commit editingStyle")
}
的commit editingStyle
功能永远不会触发,因为我希望它。
我删除了我的editActionsForRowAt
方法,或许是因为我在定义自定义按钮时搞了些东西。我现在看到默认的“删除”按钮,但commit editingStyle
仍然不会启动。
对于什么是值得的,这是UITiewController(不是UITableViewController)中的UITableView,其中.dataSource和.delegate都设置为有问题的类。它也是一个NSFetchedResultsControllerDelegate。
即使是Master/Detail模板项目(Xcode 8.3.2)也有这些方法,并且不支持完整的刷卡。也许我正在阅读的内容,建议从右到左完全刷卡是内置的,是不准确的。 –