解散UIImagePickerController破坏了父viewController的帧大小 - iOS 8

时间:2015-03-27 17:26:37

标签: ios objective-c uiimagepickercontroller

当我在媒体类型为kUTTypeMovie时解雇UIImagePickerController(以模态方式呈现)时 - 在iOS 8上它将父视图控件的帧大小打破了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:^
    {
    }];
}

Project使用storyboard,我正在使用xCode 6.1

1 个答案:

答案 0 :(得分:1)

你需要在视图中隐藏状态栏才会出现&使用下面的代码调用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];

});