Objective c CNContactPickerViewController联系人列表偏移问题
描述:如果我在我的应用程序中的其他地方设置“[[UIScrollView外观]SetContentInsertAdjustmentBehavior:UIScrollViewContentInsertAdjustmentNever];”,CNContactPicerViewController中的前两项将被覆盖且无法触摸。设置UIScrollViewContentInsertAdjustmentAutomatic back before present Contact Picer将有助于触摸前两项,但联系人列表的初始位置不正确Objective c CNContactPickerViewController联系人列表偏移问题,objective-c,ios-contacts,Objective C,Ios Contacts,描述:如果我在我的应用程序中的其他地方设置“[[UIScrollView外观]SetContentInsertAdjustmentBehavior:UIScrollViewContentInsertAdjustmentNever];”,CNContactPicerViewController中的前两项将被覆盖且无法触摸。设置UIScrollViewContentInsertAdjustmentAutomatic back before present Contact Picer将有助于触摸前两项
- (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;
}
预期结果:
实际结果: