在 iPad 中旋转全屏视频时,导航栏和状态栏之间出现奇怪的重叠错误

发布于 2024-11-24 10:05:05 字数 824 浏览 1 评论 0原文

我正在我的应用程序中实现一个视频播放器,当视频播放器全屏工作时旋转 iPad 时会发生奇怪的事情。

我的测试用例很简单:

1.- 我将方向设置为垂直

2.- 我开始视频播放(非全屏)

3.- 我设置全屏

4.- 我在全屏时旋转 iPad 并将其设置为水平

5.- 我回到“非全屏”

6.- 导航和状态栏以一种非常愚蠢的方式重叠。看:

在此处输入图像描述

7.- 然后我再次将 iPad 旋转至垂直

状态和导航栏不再重叠。再看一遍:

在此处输入图像描述

8.- 然后我来回旋转到水平和垂直,一切都正常。

提示?

我读过其他一些问题,但没有得出明确的结论。 苹果(?)有一些“官方”修复,承认存在某种错误,并尝试修复类似的情况,如下所示: 使用 MPMoviePlayerViewController 时的 iPad 旋转错误

但即使实现了这个简单的解决方案,该错误仍然出现 为我。 (我不知道这是否是一个错误,或者它甚至可能是一个功能(?))

我会尝试更多的混乱,但非常欢迎帮助。

问候

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

执手闯天涯 2024-12-01 10:05:05

在替换 rootViewController 之前取消隐藏状态栏可以解决此错误:

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

Unhiding the status bar BEFORE replacing rootViewController works around this bug:

[UIApplication sharedApplication].statusBarHidden=NO;
self.window.rootViewController = whatever
风蛊 2024-12-01 10:05:05

效果很好

[[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;
}

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;
}
夜血缘 2024-12-01 10:05:05

你可以试试这个代码

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

}

You can try this code

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

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文