View Controllers in iPad Apps

When you create and storyboard apps for iOS 6, view controllers will be the heart and soul of your storyboard. View controllers are typically the objects that serve as delegates and data sources for Table views as well as for other kinds of framework views. View controllers have vital iPad responsibilities, such as the following:

  • Managing a set of views: This includes creating the views as well as flushing them from memory during low-memory situations.

  • Responding to a change in the device’s orientation: If, say, the user causes the iPad to switch from landscape to portrait orientation, the view controller responds by adjusting its views to match the new orientation.

  • Creating a Modal (not model) view: A Modal view is a child window that displays a dialog that requires the user to do something (tap the Yes or Cancel button, for example) before returning to the application.

    You use a Modal view to ensure that the user has paid attention to the implications of an action (for example, “Are you sure you want to delete all your contacts?”).

  • Display a popover: A popover is a transient view that is shown when people tap a control or an onscreen area. Popovers are used in a variety of ways, including displaying the Master view when a Split View app is in Portrait orientation, or displaying additional information about a selection.

  • Respond to user input and navigation: While the view processes a touch using the Target-Action pattern, it is almost always the view that is the target of the action — responding to the touch appropriately.

In addition to the base UIViewController class, UIKit includes the following:

  • subclasses such as UITabBarController (to manage the Tab bar)

  • UITableViewController (which you use to manage Table views)

  • UINavigationController (which implements navigation back and forth between view controllers)

  • UIPageViewController (to allow users to navigate between view controllers using the specified transition)

  • UIImagePickerController (to access the camera and Photo library on the iPad)

  • UISplitViewController (which you’ll be using on the iPad — only — to display the side-by-side views you see in this figure, for example).

    image0.jpg
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.