在调用弹出QBImagePickerController之后发现顶部上移了一部分。问题如下:
图片.png
寻思着肯定是适配的问题。
记得已经在AppDelegate里面设置了全局了的UIScrollViewContentInsetAdjustmentNever。
问题确实是再这里,解决方案如下:
第一:在弹出系统相册的函数里按顺序添加
//先写这个
if (@available(iOS 11, *)) {
UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
}
QBImagePickerController *qbpicker = [[QBImagePickerController alloc] init]; qbpicker.delegate = self;
// 再写这个
if (@available(iOS 11, *)) {
UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
}
[self presentViewController:qbpicker animated:YES completion:nil];
第二:然后在代理方法里添加
-(void)qb_imagePickerController:(QBImagePickerController *)imagePickerController didFinishPickingAssets:(NSArray *)assets{
//再设置为never
if (@available(iOS 11, *)) {
UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[self dismissViewControllerAnimated:YES completion:NULL];
}
正常效果:
图片.png
网友评论