iOS11 打开相册上移问题解决方法

原因是app设置了:

if (@available(iOS 11, *)) {
    UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
 }

解决方案 :
在弹出系统相册前添加

 if (@available(iOS 11, *)) {
 UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
    }
 UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
 ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
 ipc.delegate = self;
 ipc.allowsEditing = YES;
 if (@available(iOS 11, *)) {
        UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
    }
 [self presentViewController:ipc animated:YES completion:nil];

在 - (void)imagePickerController:(UIImagePickerController )picker didFinishPickingMediaWithInfo:(NSDictionary*)dic添加

if (@available(iOS 11, *)) {
        UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }

猜你喜欢

转载自blog.csdn.net/heqiang2015/article/details/84249868
今日推荐