tôi thực hiện editActionsForRowAtIndexPath
và commitEditingStyle
swipe đang làm việc nhưng không có chỉnh sửa hành động xuất hiện trên UITableViewCell
tôi thực hiện editActionsForRowAtIndexPath và commitEditingStyle nhưng không chỉnh sửa hành động xuất hiện trên tableViewCell khi vuốt sang các tế bào
thực hiện của tôi cho editActionsForRowAtIndexPath
và commitEditingStyle
như sau:
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]
}
Bất kỳ trợ giúp sẽ được đánh giá cao
làm bạn canEditRowAtIndexPath impliemtn trở YES –
vâng tôi đã làm và nó hoạt động trong một viewController mà không thực hiện canEditRowAtIndexPath – Abdelrahman