当我关闭媒体类型为 kUTTypeMovie 的 UIImagePickerController(模态呈现)时 - 在 iOS 8 上,它打破了父 viewController 的框架大小 20px(状态栏高度)。在 iOS 7 上一切正常。
呈现选择器代码:
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
picker.mediaTypes = @[(NSString*)kUTTypeMovie];
[self.navigationController presentViewController:picker animated:YES completion:nil];
隐藏选择器代码:
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[picker dismissViewControllerAnimated:NO completion:^
{
}];
}
项目使用 Storyboard,我使用的是 xCode 6.1
最佳答案
您需要在 View 中隐藏状态栏,并且您使用以下代码调用 imagepicker 的类的 ViewDidLoad 将出现。
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
});
您还需要设置状态栏以显示在 ViewDidAppear 中:
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
});
关于ios - 关闭 UIImagePickerController 破坏了父 viewController 的框架大小 - iOS 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29306623/