我试图调用tableview" editActionsForRowAtIndexPath"按钮动作中的方法。编辑视图未显示

时间:2017-01-27 15:05:19

标签: ios swift uitableview

您可以在此处查看我的代码:

@IBAction func edit(sender: UIButton?) {
let indexPath = NSIndexPath(forRow: 0, inSection: 1)

    self.tableView(tableVw, editActionsForRowAtIndexPath: indexPath)
}

2 个答案:

答案 0 :(得分:2)

您似乎错过了UITableView行为的关键点。请先考虑阅读官方文档:https://developer.apple.com/reference/uikit/uitableview

答案 1 :(得分:0)

你倒退了,

optional func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]?

函数由它的委托上的表视图调用,而你应该实现它并返回一个你想要显示的自定义动作数组 - 你不应该调用它来向表视图发出信号。

https://developer.apple.com/reference/uikit/uitableviewdelegate/1614956-tableview