同事写的当webview里有视频时 横屏观看后状态栏异常的处理方法

来源:互联网 发布:创维50寸4k网络电视 编辑:程序博客网 时间:2024/05/21 12:42

留着吧  以后或许有用:



- (BOOL)shouldAutorotate

{

    NSLog(@"yyyyshouldAutorotate%i",isVideoPlaying);

    

    

    if (!self.viewStatus) {

        _viewStatus = [[UIView alloc]initWithFrame:CGRectMake(0, -20, self.view.frame.size.width, 64)];

    }

    if (![self.navigationBar.subviews containsObject:_viewStatus]) {

        

        UIImageView * img = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40)];

       

        img.backgroundColor = NAVIGATIONBAR_COLOR;

        img.alpha = 0.92;

        [_viewStatus addSubview:img];

        [self.navigationBar addSubview:_viewStatus];

        [self.navigationBar sendSubviewToBack:_viewStatus];

        _viewStatus.backgroundColor = [UIColor whiteColor];

        

    }

    CGRect frame = self.navigationBar.frame;

    frame.origin.y = 20;

    frame.size.height = 44;

    self.navigationBar.frame = frame;

    if (isVideoPlaying) {

        [self.navigationBar setTransform:CGAffineTransformMakeTranslation(0, 0)];

        return YES;

        

    }else{

       

        return [[UIDevice currentDevice] orientation] == UIInterfaceOrientationPortrait;

    }

}


0 0
原创粉丝点击