我重写了canEditRowAtIndexPath
方法:
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
在此处设置属性(但是在哪里删除附件?):
但这对我不起作用。
为了获得编辑功能,您需要告诉表视图进行编辑。某处(可能是针对的操作UIBarButtonItem
):
tableView.setEditing(true, animated: true)
为了删除编辑功能,您需要告诉表视图停止编辑。其他地方(可能在相同的动作中):
tableView.setEditing(false, animated: true)
请注意,这editButtonItem()
将自动创建UIBarButtonItem
具有此功能的。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句