在調(diào)用彈出QBImagePickerController之后發(fā)現(xiàn)頂部上移了一部分鸡挠。問(wèn)題如下:
圖片.png
尋思著肯定是適配的問(wèn)題拇勃。
記得已經(jīng)在AppDelegate里面設(shè)置了全局了的UIScrollViewContentInsetAdjustmentNever霉赡。
問(wèn)題確實(shí)是再這里辅辩,解決方案如下:
第一:在彈出系統(tǒng)相冊(cè)的函數(shù)里按順序添加
//先寫這個(gè)
if (@available(iOS 11, *)) {
UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
}
QBImagePickerController *qbpicker = [[QBImagePickerController alloc] init]; qbpicker.delegate = self;
// 再寫這個(gè)
if (@available(iOS 11, *)) {
UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
}
[self presentViewController:qbpicker animated:YES completion:nil];
第二:然后在代理方法里添加
-(void)qb_imagePickerController:(QBImagePickerController *)imagePickerController didFinishPickingAssets:(NSArray *)assets{
//再設(shè)置為never
if (@available(iOS 11, *)) {
UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[self dismissViewControllerAnimated:YES completion:NULL];
}
正常效果:
圖片.png