override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
let object: PFObject = self.noteObjects.objectAtIndex(indexPath.row) as! PFObject
object.delete()
When I decided to use delete it worked but the app crashes錯誤迅速當我刪除一行,這樣做,但崩潰
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
this is the error * Assertion failure in -[UITableView _endCellAnimationsWithContext:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UITableView.m:1720 2016-01-19 00:07:30.451 Registro1[21154:852511] *
它確實刪除了正確的行 –
現在我有這個錯誤: –
它是一個分段tableview嗎?如果要刪除某一部分中最後一項的行,則需要刪除整個部分。否則,它會拋出這個異常。 –