[英]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! 谢谢你的尽心帮助!
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)
)
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)]
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.