Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This chapter discussed the UIView and UIViewController classes. When developing an iOS application, every content view should have its own nib. Remember, placing views in their own nib conserves memory by only loading the components needed to render the current view. The development pattern for creating a view is straightforward: Subclass a UIViewController in Xcode. Create the UIView in its own nib. Then, in the nib, connect the view to the view controller. To make your code easier to test and debug, keep the name consistent between the view, view controller, and nib. Implement any view-related life cycle methods you wish to handle in the view’s view controller. Keep your custom code to a minimum, though—remember, the controller’s job is to serve as glue code between your view and your model. Consider placing more advanced code in helper classes, and then have your controller use these helpers.
Now that you understand how to build each screen’s content, you can learn how to develop views that aggregate your individual views into a multiple-screen application. In the next chapter, you begin exploring multiview applications with the UITabBar and UITabBarController. After learning about tab bars, you move to the navigation controllers and then tables. These views let you aggregate content views into richer multiscreen applications.