Strange overlapping bug between navigation and sta

2019-04-11 13:49发布

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:

enter image description here

7.- Then I rotate the iPad to Vertical again

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

enter image description here

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

3条回答
兄弟一词,经得起流年.
2楼-- · 2019-04-11 14:00

unhiding status bar BEFORE replacing rootViewController works around this bug

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

查看更多
▲ chillily
3楼-- · 2019-04-11 14:00

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;
}
查看更多
姐就是有狂的资本
4楼-- · 2019-04-11 14:05

You can try this code

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

}
查看更多
登录 后发表回答