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

9. View Controllers > Class Organization

Class Organization

Each of the views shown and described in Chapter 5, “Test-Driven Development of an iOS App,” is basically the same: There’s a table, whether it’s a table of topic names, of question titles or the question body and answers. Navigating through the app provides a “master-detail” representation, where tapping on an item at one level provides more information about that item. Therefore, there’s really only one view to support: a table view with a data source to represent the information being displayed and a delegate to respond to taps from the user, preparing the next level of table view if appropriate.

If there’s only one view in the app, then only one view controller is needed. A problem frequently occurring in iOS apps is having a different view controller and XIB for every level in an app, even though they’re all presenting data in very similar ways. The end result of this is a lot of repeated code throughout the app, with the application’s behavior being very tightly coupled to the data presentation.


  

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