iOS 11 调用系统相册界面往上偏移问题

问题示例:

示例图片

在AppDelegate.m设置了

if (@available(iOS 11.0, *)) {

        [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];

}

打开相册后界面整体往上偏移。两种办法:

方法一:(参考:iOS 11打开系统相册列表向上偏移问题 并稍作补充)

在打开相册前设置

if (@available(iOS 11, *)) {

        UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;

}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info

方法中设置

if (@available(iOS 11, *)) {

        UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;

}


方法二:将导航条的毛玻璃效果去除(参考:UIImagePickerController iOS11调起相册 中的照片被导航栏遮挡

        UIImagePickerController *controller = [[UIImagePickerController alloc] init];

        controller.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

        controller.delegate = self;

        controller.navigationBar.translucent = NO; //去除毛玻璃效果

        [self presentViewController:controller animated:YES completion:nil];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容