Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 7: Selecting and Editing Table Content > Inserting and Deleting Rows

Inserting and Deleting Rows

As you'll probably be expecting by now, inserting and deleting rows is a multistage process that involves the tableView, the delegate, and the dataSource working in tandem with each other.

The process involves the following:

  1. Putting the table into editing mode.
  2. For each row, checking whether editing is allowed and displaying the editing controls if it is
  3. Responding to the user's touches on the editing controls by sending a message to the dataSource
  4. Updating the model
  5. Updating the table's rows

The sequence of events, and the passing of messages between tableView, dataSource, and delegate, is illustrated in Figure 7–9.

images

Figure 7–9. Messages passed during tableView editing

At first glance, this looks horrendously complicated. It's actually not that bad, as you'll see as you step through it.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial