//import contacts by using contact picker
CNContactPickerViewController *contactPicker = [CNContactPickerViewController new];
contactPicker.delegate = self;
NSPredicate *filterPredicate = [NSPredicate predicateWithFormat:@"phoneNumbers.@count >= 1"];
contactPicker.predicateForEnablingContact = filterPredicate;
[self presentViewController:contactPicker animated:YES completion:nil];
- (void) contactPicker:(CNContactPickerViewController *)picker
didSelectContacts:(NSArray<CNContact *> *)contacts {
//code for selecting multiple contacts
}
-(void)contactPickerDidCancel:(CNContactPickerViewController *)picker {
NSLog(@"Cancell");
}
我使用上面的代码导入联系人,我可以导入联系人。但我需要从CNContactPickerViewController中删除搜索栏。我已经尝试过堆栈溢出中提供的以下解决方案,但它无法正常工作。任何帮助将非常感激。
答案 0 :(得分:0)
由于CNContactPickerViewController
是UIRemoteView
,因此您无权访问它。因此,这是不可能的。