1 / 6

View Controllers

View Controllers. In the Model-View-Controller (MVC) design pattern, a controller object provides the custom logic needed to bridge the application’s data to the views and other visual entities used to present that data to the user.

lane
Télécharger la présentation

View Controllers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. View Controllers • In the Model-View-Controller (MVC) design pattern, a controller object provides the custom logic needed to bridge the application’s data to the views and other visual entities used to present that data to the user. • In iOS applications, a view controller is a specific type of controller object that you use to present and manage a set of views. View controller objects are descendants of the UIViewController class, which is defined in theUIKit framework. • Applications running on iOS–based devices have a limited amount of screen space for displaying content and therefore must be creative in how they present information to the user. Applications that have lots of content may have to distribute that content across multiple screens or show and hide different parts of content at different times. View controller objects provide the infrastructure for managing your content-related views and for coordinating the showing and hiding of them.

  2. Benefits of View Controllers • There are many reasons to use view controllers in your application and very few reasons to avoid them. • View controllers make it easier for you to implement many of the standard interface behaviours found in iOS applications. • They provide default behaviour that you can use as is or customize when needed. • They also provide a convenient way to organize your application’s user interface and content.

  3. Types of View Controllers • There are two types of view controllers • Custom View Controller • Container View Controller Most iOS applications have at least one view controller and some have several. Broadly speaking, view controllers are divided into three general categories that reflect the role the view controller plays in your application.

  4. A Custom View Controller is a controller object that you define for the express purpose of presenting some content on the screen. Most iOS applications present data using several distinct sets of views, each of which handles the presentation of your data in a specific way. For example, you might have a set of views that presents a list of items in a table and another set that displays the details for a single item in that list. The corresponding architecture for such an application would involve the creation of separate view controllers to manage the marshaling and display of each set of views.

  5. A Container View Controller is a specific type of view controller object that manages other view controllers and defines the navigational relationships among them. Navigation, tab bar, and split view controllers are all examples of container view controllers. You do not define container view controllers yourself. Instead, you use the container view controllers provided by the system as is.

More Related