简体   繁体   English

如何处理ABPeoplePickerNavigationController中的属性选择?

[英]How do I handle selecting a property in ABPeoplePickerNavigationController?

I am having some trouble with this.. I see that we are supposed to be using the property: 我对此有一些麻烦。.我看到我们应该使用该属性:

predicateForSelectionOfProperty

for determining which properties get 'selected', and I'm actually kind of bummed for there not being a 来确定哪些属性被“选中”,而实际上我有点儿沮丧,因为没有

predicateForEnablingProperty

because I only want phone numbers, for my use case. 因为在我的用例中,我只想要电话号码。

That said, nothing I use for predicateForSelectionOfProperty seems to do what I want. 也就是说,我对predicateForSelectionOfProperty所使用的任何内容似乎都无法满足我的要求。 What I want is, when I select a contact's phone number, it should call the delegate callback.. but instead, right now, it is calling them! 我想要的是,当我选择一个联系人的电话号码时,它应该调用委托回调。.但是,现在,它正在呼叫他们!

Maybe I'm just completely missing something, because I would actually rather just have a list of my contacts, with phone numbers, and only show the phone numbers.. maybe I'm not even heading in the right direction with this. 也许我只是完全错过了一些东西,因为我实际上只想知道我的联系人列表,电话号码,而只显示电话号码。.也许我什至没有朝着正确的方向前进。

Thanks for any help you can offer! 谢谢你的尽心帮助!

  1. If you don't want it to call the number, you should: 如果您不希望它拨打该号码,则应:

    • specify the peoplePickerDelegate ; 指定peoplePickerDelegate ; and

    • implement peoplePickerNavigationController:didSelectPerson:property:identifier: 实现peoplePickerNavigationController:didSelectPerson:property:identifier:

    • don't specify a predicateForSelectionOfProperty (or if you do, make sure it returns true , eg NSPredicate(value: true) ) 不要指定predicateForSelectionOfProperty (或者,如果指定,请确保它返回true ,例如NSPredicate(value: true)

  2. Obviously, if you don't even want it to show you unrelated information about contacts, specify the displayedProperties array, eg 显然,如果您甚至不希望它向您显示与联系人无关的信息,请指定displayedProperties数组,例如

     controller.displayedProperties = [NSNumber(int: kABPersonPhoneProperty)] 
  3. Alternatively, if you wanted to customize this UI further, you could just use the AddressBook.framework to extract the phone numbers from the address book and present whatever UI you want. 另外,如果您想进一步自定义此UI,则可以使用AddressBook.framework从通讯簿中提取电话号码并显示所需的UI。

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

相关问题 如何将ABPeoplePickerNavigationController设置为MainView? - How I can set the ABPeoplePickerNavigationController as MainView? 如何更改ABPeoplePickerNavigationController的UINavigationBar的颜色? - How can I change color of UINavigationBar of ABPeoplePickerNavigationController? 如何更改ABPeoplePickerNavigationController backButton颜色? - How to change ABPeoplePickerNavigationController backButton color? 如何在Swift中使用ABPeoplePickerNavigationController选择多个联系人 - how to select multiple contacts with ABPeoplePickerNavigationController in Swift 如何在核心数据堆栈中的客户端上使用ABPeoplePickerNavigationController - How to use ABPeoplePickerNavigationController on clients in core data stack 如何在IOS中隐藏ABPeoplePickerNavigationController的默认选项 - How to hide the default options of ABPeoplePickerNavigationController in IOS 如何从ABPeoplePickerNavigationController获取街道地址 - How to get street address from ABPeoplePickerNavigationController 如何处理UIAlertController的操作? - How do I handle the actions of a UIAlertController? iOS:如何快速处理此选择器? - iOS: How do I handle this selector in swift? 如何处理与NSFetchedResultsController的关系? - How do I handle a relationship with a NSFetchedResultsController?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM