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
  • PrintPrint
Share this Page URL
Help

6. Saving, Editing, and Sorting Data: Ev... > The table view doesn’t know its data...

The table view doesn’t know its data has changed

The table view does a number of things to improve performance as much as possible. As a result, if you just change values in the datasource without telling it, it won’t know that something has changed. In our case, we added a new value to the array used by our datasource but didn’t let the table view know about it.

image with no caption

You need to ask the table view to reload its data

Since we’re modifying the underlying data used by the datasource, the easiest way to refresh the table is to ask it to reload its data. You do this by sending it the reloadData message. This tells the tableview to reconstruct everything—how many sections it thinks it has, the headers and footers of those sections, its data rows, etc.


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint