What confirmation message for deleting rows?


#1

On p. 214, the book states:

[quote]Before the table view will delete a row, it sends its data source a message about the proposed deletion and waits for a confirmation message before pulling the trigger.
[/quote]
What confirmation would this be? I understand that the table view sends tableView:commitEditingStyle:forRowAtIndexPath: to its data source when a deletion is attempted, but this method returns void, not BOOL. By saying that the table view “waits for a confirmation message”, do you really mean that it waits for the data source to send it a deleteRowsAtIndexPaths:withAnimation: message?

I know I’m parsing this pretty finely, but I’m just trying to understand.


#2

That’s right, tableView:commitEditingStyle:forRowAtIndexPath: does not ask the application if it is okay to delete the specified row in the tableview; rather, it tells the application that the user wants to delete the said row, and it is up to the application to actually delete the row in the tableview by sending deleteRowsAtIndexPaths:withRowAnimation:.

I can see your confusion given the way the text is phrased in the book. Moreover, in many other situations, the style is indeed to ask the application if something can be done, and let the application reply with a BOOL value. But that’s not the case here with deleting rows from a tableview in iOS.