UIImagePickerController hiding status bar issue in

2019-05-15 10:21发布

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条回答
闹够了就滚
2楼-- · 2019-05-15 10:50

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)];
}
查看更多
登录 后发表回答