Having an interesting little problem with my iPhone app. I have a view with a table and each cell, when clicked, plays a video fullscreen then when you press done, the video sto
Maybe the animation from when the video view disappears is causing a timing issue with the status bar animation.
try delaying the statusBarHidden = NO call by a few seconds.
NSInteger delay = 3;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
[UIApplication sharedApplication].statusBarHidden = NO;
});
I've found that with the given solutions the content often disappears beneath the status bar. This approach fixes it.
Register for MPMoviePlayerWillExitFullscreenNotification
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerWillExitFullscreen:)
name:MPMoviePlayerWillExitFullscreenNotification
object:self.moviePlayer];
And then reset the status bar visibility AND remove and re-add the rootViewController from the main window, this will make sure that the bounds of the view are correct again.
- (void)moviePlayerWillExitFullscreen:(NSNotification *)notification {
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
id rootViewController = appDelegate.window.rootViewController;
appDelegate.window.rootViewController = nil;
appDelegate.window.rootViewController = rootViewController;
}
You can just set the delay to be a float instead. So it would be
float delay = 0.1;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
[UIApplication sharedApplication].statusBarHidden = NO;
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;
});
I had the same problem and solved it by modifying richerd's code a bit. 0.1 second is acceptable imo. I also had to change the status bar style since it returned a BlackTranslucent bar style and the original was BlackOpaque style. But works fine now.