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 ...

Get Programming iOS 4 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.