1. 程式人生 > >UIImagePickerController iOS11調起相簿 中的照片被導航欄遮擋

UIImagePickerController iOS11調起相簿 中的照片被導航欄遮擋

為了適配iOS11下來重新整理下下偏移問題,全域性設定了 [UIScrollViewappearance] 的ContentInsetAdjustmentBehavior為UIScrollViewContentInsetAdjustmentNever導致ScrollView向上偏移了,而在iOS11以下卻沒問題

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

        [[UIScrollViewappearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];

    }


解決辦法:將導航條的毛玻璃效果去除掉就可以了

UIImagePickerController *pickerController = [[UIImagePickerControlleralloc] init];

    pickerController.editing = YES;

    pickerController.delegate = self;

    pickerController.allowsEditing = YES;

//    去除毛玻璃效果

    pickerController.navigationBar.translucent

= NO;

    pickerController.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;

    [selfpresentViewController:pickerController animated:YEScompletion:nil];