简体   繁体   中英

Need only phone number from default contact

I'm opening a default address book contact in my app, but it's opening all the detail of the contact. I only want the phone number, not the other details. How do I do this?

Below is the code I use.

ABPersonViewController *personController = [[ABPersonViewController alloc] init];

personController.personViewDelegate = self;
personController.allowsEditing = NO;

personController.displayedPerson = person;
personController.addressBook = ABAddressBookCreate();

personController.displayedProperties = [NSArray arrayWithObjects:           [NSNumber numberWithInt:kABPersonPhoneProperty],                                            nil];   

[[self navigationController] pushViewController:personController animated:YES];
ABContact *contact = [collection objectAtIndex:indexPath.row];
cell.textLabel.text = contact.contactName;
cell.detailTextLabel.text=contact.phonenumbers;

i used abcontactshelper class for this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM