【问题标题】:How to show tableview cell edit view when tap the cell?点击单元格时如何显示表格视图单元格编辑视图?
【发布时间】:2017-01-30 08:20:44
【问题描述】:

我的要求是在点击单元格时显示 tableviewcell 编辑视图。滑动时“editActionsForRowAtIndexPath”正在工作,但我希望在点击单元格时执行此操作。enter image description here

【问题讨论】:

标签: ios objective-c iphone swift ipad


【解决方案1】:

我不知道你用什么刷卡。但是如果你想在用户点击单元格时处理一些动作,你应该使用 didSelectRowAtIndexPath 函数。例如;

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    print("Tapped")
}

【讨论】:

  • 我的要求是在 TAP 上编辑 tableview 单元格而不是滑动。查看效果:-i.stack.imgur.com/sCoUS.gif点击单元格时我想要这个效果。
【解决方案2】:

在 didselect 委托方法上使用此代码,我认为它会对您有所帮助。

self.tableView.editing = true

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多