manicwave Surf the wave

AddressBook displayedProperties -- iPhone SDK

There aren't many examples of how to control the displayed properties of an ABPeoplePickerNavigationController. Displayed properties allow you to control which attributes of a contact are displayed when selecting a person.

The following code does the trick:

       ABPeoplePickerNavigationController *picker =  [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[picker setDisplayedProperties:[NSArray arrayWithObjects: [NSNumber numberWithInt: kABPersonPhoneProperty], [NSNumber numberWithInt:kABPersonEmailProperty], nil]];
[self presentModalViewController:picker animated:YES];
[picker release];

The displayed properties can include phone (kABPersonPhoneProperty), email (kABPersonEmailProperty), instant messaging (kABPersonInstantMessageProperty) etc. See ABPerson.h for a full list.

Filed under