【发布时间】:2015-06-23 13:23:04
【问题描述】:
我实现了editActionsForRowAtIndexPath 和commitEditingStyle 滑动正常,但UITableViewCell 上没有出现编辑操作
我对@987654324@ 和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]
}
任何帮助将不胜感激
【问题讨论】:
-
你是否暗示 canEditRowAtIndexPath 返回 YES
-
是的,我做到了,它在另一个 viewController 中工作,没有实现 canEditRowAtIndexPath
标签: ios swift uitableview tableviewcell uitableviewrowaction