UIImagePickerController hiding status bar issue in

2019-05-15 10:55发布

问题:

I did this

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}

and it is great in iOS7, but iOS8 have some trouble with transitions in navigation bar between views and says:

Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

So, is any known solution to that?

回答1:

Try this.

Make sure you have a delegate to the imagepicker.

imagePicker.delegate = self

now define this function

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [viewController prefersStatusBarHidden];
    [viewController performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}