chapter fourteen
Editing Table Views
One of the most attractive features of table views is that there is a great deal of built-in functionality for editing them. Editing a table view means editing the view’s structure, which can consist of adding or removing rows as well as rearranging them. Editing the content of a table view is not very much different from editing the text fields (and other interface elements) in a UIView
. (You find out more about editing table view content in Chapter 17, “Back to the Storyboard: Enhancing the Interface.”)
The default behavior of the master view controller in the Master-Detail Application template (and your Party Planner app) enables you to add and delete rows in the table view. However, you can’t rearrange the rows in that table view. By now, you have probably noticed that in the illustrations of Party Planner at this point, there are two parties: Party 2 and Party 1. They are displayed in that order, and for many people, that doesn’t make sense. Some automated sorting (alphabetical, by date, or the like) would be preferable to a sequence that appears out of order.
Depending on the data that you are displaying in a table view, you may want to sort the rows in some understandable way, or you may want to allow users to rearrange them. Your choice is dependent on what the data is and how much of it there is. If you are planning to display a list of 100 items, some form of automated sorting makes sense. For a smaller list, manual sorting and arrangement ...
Get iOS 6 Foundations now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.