Chapter 4. View Controllers

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • Understand the structure of an iPad Application project

  • How to create a Window-based Application and manually add a View Controller and a View window to it

  • How to create views dynamically during runtime

  • How to wire up events of views with event handlers via code

  • How to switch to another view during runtime

  • How to animate the switching of views

  • How to create a Split View-based Application

  • How to create a Tab Bar Application

So far you've dealt only with single-view applications — that is, applications with a single View Controller. The previous chapters all use the View-based Application template available in the iPhone SDK because it is the simplest way to get started in iPad programming. When you create a View-based Application, there is one View Controller (named <project_name>ViewController by the iPhone SDK) by default.

In real-life applications, you often need more than one View Controller, with each controlling a different view displaying different information. This chapter shows various types of projects you can create for your iPad and how each utilizes a different type of View Controller. You will also learn how to create multiple views in your application and then programmatically switch among them during runtime. In addition, you learn how to animate the switching of views using the built-in animation methods available in the iPhone SDK.

THE VIEW-BASED APPLICATION TEMPLATE

When you create a View-based Application project ...

Get Beginning iPad™ Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.