CNContactPickerViewController删除搜索栏(目标c)

时间:2018-03-19 09:33:58

标签: ios objective-c iphone cncontactviewcontroller

//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");
}

enter image description here

我使用上面的代码导入联系人,我可以导入联系人。但我需要从CNContactPickerViewController中删除搜索栏。我已经尝试过堆栈溢出中提供的以下解决方案,但它无法正常工作。任何帮助将非常感激。

How to hide/Remove the search bar on Contact Picker

1 个答案:

答案 0 :(得分:0)

由于CNContactPickerViewControllerUIRemoteView,因此您无权访问它。因此,这是不可能的。