【问题标题】:I am trying to call the tableview "editActionsForRowAtIndexPath" method in a button action. the editing view is not showing我正在尝试在按钮操作中调用 uitableview“editActionsForRowAt IndexPath”方法。编辑视图未显示
【发布时间】:2017-01-27 15:05:18
【问题描述】:

你可以在这里看到我的代码:

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

    self.tableView(tableVw, editActionsForRowAtIndexPath: indexPath)
}

【问题讨论】:

    标签: ios swift uitableview


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      你搞错了,

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

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-08-01
        • 2022-01-08
        • 1970-01-01
        • 2017-05-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多