iOS 7播放视频后状态栏消失

9

我不是唯一一个遇到这种问题的人。这里还有一个人也遇到了类似的问题,Status bar height changes after playing a Youtube video。但是我仍然找不到解决方法。我没有使用MPMoviePlayerController。我认为我只需要使用这些代码:

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];

self.webView.frame = CGRectMake(0.0,
                                20.0,
                                self.webView.frame.size.width,
                                self.webView.frame.size.height);

但是它并没有起作用。

请看下面的图像...

enter image description here

首先,这就是我的“主页”所看起来的样子。

enter image description here

当我播放来自YouTube / Vimeo(或任何其他)的视频时,状态栏会消失。

enter image description here

当我返回时,看到它们聚在一起了。

enter image description here

发现FB找到了如何处理这个问题。他们让状态栏在那里出现。

有什么帮助吗?

提前致谢!


我遇到了同样的问题。你找到解决方案了吗? - user2955351
2个回答

1

我不知道这是否适用于你的情况,但在我的情况下,当我加载UIImagePickerController并更改默认屏幕方向后,状态栏会出现。

我通过在appDelegate中添加application.statusBarHidden = YES;来解决这个问题,如下所示:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
// Detect if I need to hide the StatusBar (optional)
if (iNeedToHide == YES) {  
    application.statusBarHidden = YES;
}
return UIInterfaceOrientationMaskLandscape;

}

我希望这可以帮助你。

很抱歉,但是我需要在播放视频时让状态栏出现,以防止其他屏幕的导航栏与状态栏混在一起。我让它在打开Youtube/Vimeo网站时出现,但当我播放视频时,它会消失... - caribbean
我不知道你的视频控制器是否是导航控制器,但如果是的话,你可以使用这个委托过程并隐藏状态栏:// Esto se usa para quitar el statusBar dentro de las operaciones del UIImagePicker
  • (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { // Esconder el StatusBar. Provocado por el iOS7 y el UIImagePickerController [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; }
- Beto

1

当关闭视频播放器时,我必须禁用动画。为视频完成事件放置一个通知:

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(videoDidFinish:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:controller.moviePlayer];

然后,在该方法内,无需动画即可解除视图控制器:

- (void)videoDidFinish:(NSNotification *)notification {
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification
                                                  object:controller.moviePlayer];
    [self dismissViewControllerAnimated:NO completion:nil];
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接