//返回編輯類型,滑動刪除rem
func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {it
return UITableViewCellEditingStyle.Deleteio
}table
//在這裏修改刪除按鈕的文字List
func tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? {方法
return "點擊刪除"im
}tab
//點擊刪除按鈕的響應方法,在這裏處理刪除的邏輯di
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {co
if editingStyle == UITableViewCellEditingStyle.Delete {
self.dataList!.removeAtIndex(indexPath.row)
self.tableView!.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
}
}