Strange overlapping bug between navigation and status bars when rotating fullscreen videos in iPad

强颜欢笑 提交于 2019-12-21 19:59:03

问题


I'm implementing a video player inside my application and strange things happen when rotating the iPad when the video player is working in full screen.

My test case is kind of easy:

1.- I set orientation to Vertical

2.- I start video playing (non full screen)

3.- I set full screen

4.- I rotate the iPad while in fullscreen and set it to horizontal

5.- I go back to "non full screen"

6.- Navigation and status bar become overlapped overlapped in a very silly way. Look:

7.- Then I rotate the iPad to Vertical again

Status and Navigation Bars don't overlap anymore. Look again:

8.- Then I rotate back and forth to Horizontal and Vertical, and everything keeps being OK.

Hints?

I've read some other questions around, but no clear conclusion comes to my mind. There are some "official" fixes from apple (?) acknowledging some kind of bug, and trying to fix similar situations, like here: iPad rotation bug when using MPMoviePlayerViewController

But even implementing that easy solution, the bug still appears for me. (I don't know if it's a bug, or it might even be a feature (?))

I'll be trying some more messing, but help will be more than welcome.

Greetings


回答1:


unhiding status bar BEFORE replacing rootViewController works around this bug

[UIApplication sharedApplication].statusBarHidden=NO; self.window.rootViewController = whatever




回答2:


It works perfectly

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MovieSmallScreen) name:MPMoviePlayerDidExitFullscreenNotification object:MPplayer];

-(void)MovieSmallScreen
{



UIView *view123 = [[UIView alloc] 
                   initWithFrame:[[UIScreen mainScreen] applicationFrame]];


self.view.frame=view123.frame;
}



回答3:


You can try this code

- (void)viewWillAppear:(BOOL)animated
{
    [UIApplication sharedApplication].statusBarHidden=YES;

}


来源:https://stackoverflow.com/questions/6704203/strange-overlapping-bug-between-navigation-and-status-bars-when-rotating-fullscr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!