swift UITableView Delete Cell
UITableViewDataSource里的方法
注意要删除两个东西
1,数据要删除一行
2,然后删除teblviewcell
// Override to support conditional editing of the table view. override func tableView(tableView: UITableView!, canEditRowAtIndexPath indexPath: NSIndexPath!) -> Bool { // Return NO if you do not want the specified item to be editable. return true } // Override to support editing the table view. override func tableView(tableView: UITableView!, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath!) { if editingStyle == .Delete { // Delete the row from the data source let row:Int = indexPath.row self.diaries.removeObjectAtIndex(row) tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) } }