使用iOS 9.0中的CNContactPickerViewController,如何启用/禁用单选或多选? [英] With CNContactPickerViewController in iOS 9.0, how to enable/disable single or multiple selection?
问题描述
委托CNContactPickerDelegate具有用于单个和多个选择的方法。但是,当我们呈现视图控制器时,我们如何指定要单选还是多选呢?
The delegate CNContactPickerDelegate have methods for single and multiple selections. But how do we specify we want single or multiple selection when we present the view controller?
我想我错过了一些可能也引起我在以下内容中描述的问题的东西:< a href = https://stackoverflow.com/questions/32802087/cnui-error-selection-predicates-are-set-but-but-the-delegate-does-not-implement-cont>设置了CNUI错误选择谓词,但是委托不实现contactPicker:didSelectContact:
I guess I miss something that perhaps also causes the problem I have described in: CNUI ERROR Selection predicates are set but the delegate does not implement contactPicker:didSelectContact:
推荐答案
您只需实现所需的方法。
You need to implement ONLY the method you need.
如果只需要一个联系人,请实施:
If you want only one contact, implement:
contactPicker:didSelectContact:
contactPicker:didSelectContact:
如果要进行多项选择,请实施:
If you want multiple selection, implement:
contactPicker:didSelectContacts:
contactPicker:didSelectContacts:
如果要为一个联系人选择一个属性,请实施:
If you want select one property for one contact, implemente:
contactPicker:didSelectContactProperty:
contactPicker:didSelectContactProperty:
最后一个,不知道如何工作,看起来像个错误,因为如果实现它,我将获得多个联系人选择UI,但无法选择属性。
And the last one, don't know how work, looks like a bug, because if I implement it, I get the multiple contact selection UI, but can't select properties.
contactPicker:didSelectContactProperties:
contactPicker:didSelectContactProperties:
编辑:
最后,我从didSelectContactProperties获得了一些数据,该方法需要在predicateForSelectionOfProperty中定义。我认为名称不正确,应该使用didSelectContactsProperties,因为我得到了多个联系人的属性。
Finally I got some data from didSelectContactProperties, this method required a definition in predicateForSelectionOfProperty. I think the name is incorrect, should be didSelectContactsProperties, because I got the properties for multiple contacts.
这篇关于使用iOS 9.0中的CNContactPickerViewController,如何启用/禁用单选或多选?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!