【问题标题】:How to enable move but disable delete for some row in UITableView如何启用移动但禁用 UITableView 中某些行的删除
【发布时间】:2015-03-12 03:06:02
【问题描述】:

我的 UITableView 中的一些行需要在编辑模式下删除和移动,但有些只是移动。 在这种方法中,我可以启用或禁用某些行的编辑

override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool{
            return true
    }

但是如何在启用移动的情况下禁用某些行的删除?

【问题讨论】:

    标签: ios uitableview swift


    【解决方案1】:

    editingStyleForRowAtIndexPath返回.None

    func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
         return .None
    }
    

    显示如何删除缩进的更完整答案在这里 -> Is there any way to hide "-" (Delete) button while editing UITableView

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 2011-01-17
      • 2010-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多