In this chapter we add rows one at a time with the addNewItem: method. In it we create a new item in the shared store, get its index (it will be the last item in the array), create an index path for it and send the message insertRowsAtIndexPaths:withRowAnimation: to place the item in the table view. Makes sense. In Chapter 9,we add 5 items to the shared store in the init method. We do not send the message insertRowsAtIndexPaths:withRowAnimation: (???). In both cases (Chapter 9 and 10) we have implemented the two required methods in the UITableViewDataSource protocol, tableView:cellForRowAtIndexPath: and tableView:numberOfRowsInSection:. Now, for the questions.
- For each case (chapter) how is the table built? What is the sequence of messages used to build the table view?
- The Apple Documentation says in the Table View Programming Guide for iOS under “Inserting and Deleting Rows and Sections” that the table view’s data source must implement tableView:commitEditingStyle:forRowAtIndexPath: if it wants to insert or delete a row. It must also send the message insertRowsAtIndexPaths:withRowAnimation: to the table view to direct it to adjust its presentation. We do neither in Chapter 9. How then, are rows added to the table?