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

2. Implementing Controllers and Views > 2.7. Presenting and Managing Views with...

2.7. Presenting and Managing Views with UIViewController

Problem

You want to switch between different views in your application.

Solution

Use the UIViewController class.

Discussion

Apple’s strategy for iOS development was to use the Model-View-Controller (MVC) division of labor. Views are what get displayed to users, while the model is the data that the app manages, or the engine of the app. The controller is the bridge between the model and the view. The controller, or in this case, view controller, manages the relationship between the view and the model. Why doesn’t the view do that instead? Well, the answer is quite simple: the view’s code would get messy and that design choice would tightly couple our views with the model, which is not a good practice.


  

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