Why doesn’t ABPersonViewController show any properties besides the name?
Posted
by
abrahamvegh
on Stack Overflow
See other posts from Stack Overflow
or by abrahamvegh
Published on 2011-02-16T06:51:56Z
Indexed on
2011/02/16
7:25 UTC
Read the original article
Hit count: 542
For some reason, ABPersonViewController
is unwilling to display any properties aside from the name, no matter what properties are set for it to display.
I’m unable to use the AddressBookUI
controllers to let a user select a contact to display, since my UI has custom requirements, otherwise I’d go that route (as Apple does in their sample project.)
Here’s the code that doesn’t work — am I missing something?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// ABContact is of my own creation
ABContact *contact = [self contactAtIndexPath: indexPath];
ABPersonViewController *viewController = [[ABPersonViewController alloc] init];
// This returns a valid ABRecordRef, as indicated by the fact that the
// controller does display the name of this contact when it is loaded
viewController.displayedPerson = contact.record;
// Copied directly from Apple’s QuickContacts sample project
NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty],
[NSNumber numberWithInt:kABPersonEmailProperty],
[NSNumber numberWithInt:kABPersonBirthdayProperty], nil];
viewController.displayedProperties = displayedItems;
[self.navigationController pushViewController: viewController animated: YES];
[viewController release];
}
© Stack Overflow or respective owner