我实施editActionsForRowAtIndexPath
并且commitEditingStyle
滑动正在工作,但没有编辑操作出现在UITableViewCell
editActionsForRowAtIndexPath
我的实现commitEditingStyle
如下:
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == UITableViewCellEditingStyle.Delete {
//I did some work here
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic)
}
}
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
let deleteAction = UITableViewRowAction(style: UITableViewRowActionStyle.Normal, title: "Delete" , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
//I did some work here
tableView.reloadData()
})
return [deleteAction]
}
任何帮助将不胜感激