如何解决CNContactPickerViewController联系人列表偏移量问题
说明:如果我设置为[[[UIScrollView外观] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];”在我应用程序的其他位置,CNContactPicerViewController中的前两个项目将被覆盖,无法被触摸。在出现“ Contact Picer”之前将UIScrollViewContentInsetAdjustmentAutomatic设置回前将有助于前两个项目可触摸,但是联系人列表的初始位置不正确。
- (IBAction)chooseFromContact:(id)sender {
if (@available(iOS 11.0,*)){
[[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
ContactManager *contactManager = [ContactManager sharedInstance];
[contactManager selectContactAtController:self complection:^(Nsstring * _Nonnull phone) {
NSLog(@"Hello World");
}];
}
// in ContactManager.m
- (void)selectContactAtController:(UIViewController *)controller
complection:(void (^)(Nsstring *))completcion {
if (@available(iOS 11.0,*)){
[[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAutomatic];
}
self.contactPicker = [[CNContactPickerViewController alloc] init];
self.contactPicker.delegate = self;
[controller presentViewController:self.contactPicker animated:YES completion:nil];
self.currentViewController = controller;
self.didselectPhone = completcion;
}
预期结果:
实际结果:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。