// 删除单元格
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
self.deleteMedia(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
}
}
// 左滑动单元格 添加更多方法
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
let replaceAction = UITableViewRowAction(style: .Default, title: "更换") { (action:UITableViewRowAction, indexPath:NSIndexPath) in
}
replaceAction.backgroundColor = NAVBARCOLOR
let deleteAction = UITableViewRowAction(style: .Default, title: "删除") { (action:UITableViewRowAction, indexPath:NSIndexPath) in
self.deleteMedia(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
}
return [deleteAction, replaceAction]
}
网友评论