Creating New Rows in the Table View


#1

Initially, when adding new BNRItems, we send the message insertRowsAtIndexPaths:withRowAnimation: in addNewItem:. My understanding of the sequence of method calls from addNewItem: is this.

  1. Create newBNRItem with createItem
  2. Send the message insertRowsAtIndexPaths:withRowAnimation: to insert a row into the table view. This does not put content in the row, it just creates the row in the table
  3. The method tableView:numberOfRows:inSection: is called to return the number of rows in the table view (of the given section)
  4. The method tableView:cellForRowAtIndexPath: is called to ask the data source for a cell of data to insert at a given location in the table view. Here is where that actual data is loaded into the table

Then, we modified addNewItem: and no longer call insertRowsAtIndexPaths:withRowAnimation:. Instead we create a DetailViewController, copy the BNRItem into the controller’s item property and present it modally from a navigation controller.

Questions

  1. Is my understanding of the sequence of method calls correct?
  2. How are new rows created in the table view without sending the insertRowsAtIndexPaths:withRowAnimation: message?
  3. Another way to ask the previous question: Where is the cell with data inserted in the table if a row for it has not been created?

I feel I’m missing something basic, but I don’t know what it is.