关于ios:wkwebview横屏播放后状态栏异常问题解决

WkWebview横屏全屏播放当前,回到竖屏状态会导致状态栏异样。与这个问题相似:https://stackoverflow.com/que…

解决方案也是如此。写下oc的解决办法:

//横屏状态下暗藏状态栏,保障视频能够全屏播放
- (BOOL)prefersStatusBarHidden {
    return UIApplication.sharedApplication.statusBarOrientation == UIInterfaceOrientationLandscapeLeft || UIApplication.sharedApplication.statusBarOrientation == UIInterfaceOrientationLandscapeRight;
}
//放到viewDidLoad办法外面监听屏幕的变动
[[NSNotificationCenter defaultCenter] addObserver:self
                                                     selector:@selector(handleDeviceOrientationDidChange)
                                                         name:UIDeviceOrientationDidChangeNotification
                                                       object:nil];
//刷新statusbar的暗藏状态,当屏幕地位发生变化的时候
- (void)handleDeviceOrientationDidChange {
    [self setNeedsStatusBarAppearanceUpdate];
}

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理