Home > 2010 Fall DPS913 > Modal view controllers introduction

Modal view controllers introduction

September 30, 2010 Leave a comment Go to comments

iOS apps often include modal view controllers, which cause a new view to appear on top of the currently active view. We will learn about and work with three kinds of modal view controllers.

This week, the theme is “more view controllers”. Up until now, we have created single-view apps. Starting today, we will create multi-view apps.

.

What is a modal view controller?

When a modal view controller, and its view, appears on the screen, it becomes the top view, and the first responder. In other words, the user must interact with it, before returning to the normal program flow. When the modal view controller is dismissed, the user is able to return to and interact with the view that was covered over by the modal view.

.

Supporting documentation

Read the following chapter to get acquainted with alerts, action sheets, and modal views

iPhone Human Interface Guidelines

All of this document (152 pages in the PDF version) is worthwhile, and you should read the whole thing by study week.

.

Example apps

There are three example apps to support this topic:

Alert Action – shows an alert and an action sheet

To Do Add – shows a custom modal view

Fav Photo – shows a system-provided photo picker view

.

Discussion

For alerts and action sheets, we create a modal view controller in code, and present its view on screen.

For the others, we typically create another view controller (and view nib), and present it on screen at the right time. When you study the example apps, make note of another pattern that we will use from now on: using an instance variable in a view controller to hold the data it needs to display properly.

.


Advertisements
Categories: 2010 Fall DPS913
  1. December 14, 2010 at 5:35 pm

    the above link “Alerts, Action Sheets, and Modal Views” to apple’ website is broken. thanks.

    This may be the correct link
    http://developer.apple.com/library/safari/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html

    • petermcintyre
      December 15, 2010 at 12:03 pm

      The link has been fixed/updated. Thanks.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: