Navigation based iOS 4 iPad
In the previous chapter (entitled Creating a Simple iOS 4 iPad Table View Application) we looked at the basics of the Table View object and worked through the creation of a simple example iPad application containing a single table view without any application navigation capabilities. Also discussed in the previous chapter was the fact that table view based navigation is primarily intended for use in iPhone applications and that it is more likely that a table view will be used within the context of a Split View and Popover based interface within iPad applications.
The above caveats aside the goal of this chapter is to provide an overview of how to use the table view to implement navigation within an iPad application. The reason for including this in an iPad development book is two-fold. Primarily this is provided because a good understanding of the table view is needed to be able to implement split view and popover based interfaces on the iPad (a topic covered in some detail in the chapter entitled An iPad iOS 4 Split View and Popover Example). The second reason for including this information is the fact that there may well be instances where pure table view navigation on the iPad might actually be the right solution for your application.
Navigation based applications present a hierarchical approach to displaying information to the user. Such applications typically take the form of a navigation bar (UINavigationBar) and a series of Table based views (UITableView). Selecting an item from the table list causes the view associated with that selection to be displayed. The navigation bar will display a title corresponding to the currently displayed view together with a button that returns the user to the previous view when selected. For an example of this concept in action, spend some time using the iPhone Mail or Settings applications.
When developing a navigation-based application the central component of the architecture is the navigation controller. In addition, each screen has a table view and a corresponding view controller. The navigation controller maintains a stack of these view controllers. When a new view is displayed it is pushed onto the navigation controller’s stack and becomes the currently active controller. When the user selects the button in the navigation bar to move back to the previous level, that view controller is popped off the stack and the view controller beneath it moved to the top becoming the currently active controller.
The view controller for the first table view that appears when the application is started is called the root view controller.The goal of the example outlined in the remainder of this chapter is to design and implement an iOS iPad application that combines both navigation and table views. When completed, the application will display a table view that lists book authors. When an author is selected from the table, a second table view will be displayed listing the books written by that author. The navigation bar on the books view will contain a button to navigate back to the list of authors
No comments:
Post a Comment