How to hide status bar in UIImagepickercontroller?

前端 未结 13 1967
眼角桃花
眼角桃花 2020-11-30 02:55

I am new to iOS development. I am trying to hide status bar in UIImagePickerController. Whenever I click on \"Take photo\", status bar appears. It doesn\'t hide

13条回答
  •  忘掉有多难
    2020-11-30 03:56

    In my case I had to use presentViewController to show UIImagePickerViewController (iOS7).

    1- Set View controller-based status bar appearance to NO in .plist 2- Create a category for UIImagePickerController and in viewDidLayoutSubviews:

    - (void)viewDidLayoutSubviews{
        [super viewDidLayoutSubviews];
        [[UIApplication sharedApplication] setStatusBarHidden:YES];
    }
    

    3- Added the two following methods to the category:

    - (BOOL)prefersStatusBarHidden{
        return YES;
    }
    
    - (UIViewController *)childViewControllerForStatusBarHidden{
        return nil;
    }
    

    I hope this will help.

提交回复
热议问题