ios - 如何启用移动但禁用删除 UITableView 中的某些行

标签 ios uitableview swift

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

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

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

最佳答案

editingStyleForRowAtIndexPath 返回 .None:

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

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

关于ios - 如何启用移动但禁用删除 UITableView 中的某些行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29001216/

相关文章:

swift - iOS Tableviewcell 包含 CollectionViewCell

objective-c - UITableViewCell accessoryType位置随单元格高度变化

ios - 为照片添加多种效果

ios - 更改 UITableView 中每个单元格的 UIButton

ios - 如果后台任务过期则不调用 didBecomeActive

ios - 在 UICollectionView 中滚动时更新标签

swift - 在scrollView中显示图像不正确

ios - 如何从另一个容器 View 访问容器 View ?

ios - 在 UILabel 上显示 iPhone 剪切复制粘贴菜单

ios - 在 iOS 上发布时获得接触