Deleting Rows

In editing mode, the red circles with the minus sign (shown in Figure 9.8) are deletion controls, and touching one should delete that row. However, at this point, touching a deletion control does not do anything. (Try it and see.) 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.

When deleting a cell, you must do two things: remove the row from the UITableView and remove the BNRItem associated with it from the BNRItemStore. To pull this off, the BNRItemStore must know how to remove objects from itself.

In BNRItemStore.h, declare a new method.

@​i​n​t​e​r​f​a​c​e​ ​B​N​R​I​t​e​m​S​t​o​r​e​ ​:​ ​N​S​O​b​j​e​c​t​ ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.