Saturday, 26 April 2014

Advanced Table View Topics [Table Manners]

You can now see that table views are used for a lot more than just listing contacts and song titles. The table view classes are powerful and flexible, but that means they are—at times—complicated and confusing. The good news is that they are extensively documented and there are lots of sample projects, which you can download from Apple, that demonstrate various table view techniques.

The place to start is the Table View Programming Guide for iOS. Choose Help  Documentation and API Reference, in the search field enter Table  View Programming, and click on the Table View Programming Guide for iOS in the auto-completion list, as shown in Figure 5-29.


Figure 5-29. Locating the Table View Programming Guide

This guide will explain every major feature of table views and how to use them. Its not a short read, but if you want to know how to do something specific—like create an indexed list—this is where you should start.

Most major iOS classes have links in their documentation that will take you to a guide explaining how to use it, and related classes. In the overview section for the UITableView class, for example, there are several links totable-specific programming guides.


Summary

Give yourself a big “high five!” You’ve taken another huge step in iOS app development. You’ve learned how table views works and how to use cell objects. You know what messages your app receives when a user taps on a row,how to handle editing of rows, and how to create new rows. You created a data model and you learned how to post and observe notifications between unconnected objects.

This app still falls short in a few categories. The details of a particular item could be, well, mordetailed. But probably the most annoying issue is that your app doesnt remember anything. If you restart your app, any changes you made are lost. So for an app thats supposed to keep track of your stuff, it doesnt do a very good job.

Dont worry; we’ll attack those shortcomings in future chapters. Before you get there, take a
well-deserved rest from app development and take a brief stroll through the theory of object-oriented programming.

No comments:

Post a Comment