美文网首页
iOS webview视频全屏播放状态栏隐藏

iOS webview视频全屏播放状态栏隐藏

作者: devmao | 来源:发表于2020-04-09 14:08 被阅读0次
    //监听UIWindow隐藏
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(startVideoFullScreen) name:UIWindowDidBecomeVisibleNotification object:nil];
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(endVideoFullScreen) name:UIWindowDidBecomeHiddenNotification object:nil];
    
    
    #pragma mark - noti
    - (void)startVideoFullScreen{
        self.hiddenBar = YES;
    // 更新状态栏
        [self setNeedsStatusBarAppearanceUpdate];
    }
    - (void)endVideoFullScreen{
        self.hiddenBar = NO;
    // 更新状态栏
        [self setNeedsStatusBarAppearanceUpdate];
    }
    
    - (BOOL)prefersStatusBarHidden {
        return self.hiddenBar;
    }
    

    !!!注意:同时在info.plist中添加字段View controller-based status bar appearance, 并取值为YES时,表示以UIController对状态栏的设置为准,UIApplication对状态栏进行的设置将不起作用。

    相关文章

      网友评论

          本文标题:iOS webview视频全屏播放状态栏隐藏

          本文链接:https://www.haomeiwen.com/subject/qskcmhtx.html