简体   繁体   English

只需要来自默认联系人的电话号码

[英]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. 我为此使用了abcontactshelper类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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