O'Reilly logo

Programming iOS 4 by Matt Neuburg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Address Book Interface

The Address Book UI framework puts a user interface in front of common tasks involving the address book database and its manipulation by means of the functions and data types discussed in the preceding section. This is a great help, because designing your own interface to do the same thing would be tedious and involved, especially given properties with multiple values and the added complexity of addresses. The framework provides four UIViewController subclasses:

ABPeoplePickerNavigationController
Presents a navigation interface, effectively the same as the Contacts app but without an Edit button: it lists the people in the database and allows the user to pick one and view the details.
ABPersonViewController ABNewPersonViewController ABUnknownPersonViewController

Presents an interface showing, respectively:

  • The properties of a specific person, possibly editable
  • The editable properties of a new person
  • A proposed person with a partial set of noneditable properties

ABPeoplePickerNavigationController

An ABPeoplePickerNavigationController is a UINavigationController. Presenting it can be as simple as instantiating it, assigning it a delegate, and showing it modally. (On the iPad, you’ll probably use a popover; presenting the controller modally does work, but a popover looks better. For code that does both, see Example 29-1.) The user can survey groups and the names of all contacts in each:

ABPeoplePickerNavigationController* picker = [[ABPeoplePickerNavigationController ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required