【问题标题】:Need only phone number from default contact只需要默认联系人的电话号码
【发布时间】:2011-12-22 20:34:47
【问题描述】:

我正在我的应用中打开一个默认通讯录联系人,但它会打开联系人的所有详细信息。我只想要电话号码,而不是其他详细信息。我该怎么做?

下面是我使用的代码。

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];

【问题讨论】:

  • 我已经给出了这个答案请检查这个链接点击Here
  • 其实我只是想在默认通讯录中显示,我不必手动显示。所以为此我们必须传递属性,但它不起作用。
  • 在iPhone的默认通讯录中没有显示号码而不是姓名的选项。我认为您必须手动尝试。

标签: iphone objective-c ios


【解决方案1】:
ABContact *contact = [collection objectAtIndex:indexPath.row];
cell.textLabel.text = contact.contactName;
cell.detailTextLabel.text=contact.phonenumbers;

我为此使用了 abcontactshelper 类。

【讨论】:

    猜你喜欢
    • 2018-06-24
    • 2021-07-17
    • 1970-01-01
    • 1970-01-01
    • 2011-09-22
    • 1970-01-01
    • 2011-04-12
    • 2014-04-22
    • 2015-04-19
    相关资源
    最近更新 更多