我正在打开一个 CNContactPickerViewController 以在应用程序中使用,但我想改变它呈现的方式以满足我的应用程序需求,最好不要自己滚动并做大量的重新发明轮子。这就是我使用Objective-C打开它的方式......
self.contactPicker = [[CNContactPickerViewController alloc] init];
self.contactPicker.delegate = self;
//Only enable contacts to be selected that have atleast one email address
NSArray *propertyKeys = @[CNContactGivenNameKey, CNContactFamilyNameKey, CNContactEmailAddressesKey];
NSPredicate *enablePredicate = [NSPredicate predicateWithFormat:@"emailAddresses.@count != 0"];
self.contactPicker.displayedPropertyKeys = propertyKeys;
self.contactPicker.predicateForEnablingContact = enablePredicate;
[self presentViewController:self.contactPicker animated:YES completion:nil];
当它打开时,它目前看起来像这样:
但是,由于 SDK 中的错误,无法在这种视图上搜索人员,因为您无法从搜索结果中进行选择。我将为此提交一个错误,但与此同时,我首先要隐藏搜索栏。我发现了一些关于删除 SearchBar 的旧问题,但它们与 ABPeoplePickerNavigationController 相关,与 CNContacts 无关。我也不希望使用组,如果我可以删除该按钮并将取消按钮移到左侧,那就太好了,并且会使我的应用程序中的选择界面看起来更清晰。这就是我希望它看起来的样子:
谁能告诉我这是否可能,并指出我正确的方向?我有选择后接收联系人数组的委托方法,我的问题是它在应用程序中的外观。
提前致谢!
等离子体