iOS 7:状态栏在退出全屏视频和使用CJPAdController后仍然隐藏

时间:2014-08-16 19:07:34

标签: ios iphone video youtube statusbar

我有一个应用程序,每个选项卡上都有一个带有导航控制器的tabbar控制器。

在其中一个标签中,用户可以播放视频,并可以全屏设置。我使用LBYoutTubeView显示YouTube视频并使用以下代码显示:

- (void)viewDidAppear:(BOOL)animated{

if (controller.playbackState != MPMoviePlaybackStatePlaying && controller.playbackState != MPMoviePlaybackStatePaused) {
    controller = [[LBYouTubePlayerController alloc] initWithYouTubeURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.youtube.com/watch?v=%@", video]] quality:LBYouTubeVideoQualityLarge];
    controller.delegate = self;
    controller.repeatMode = MPMovieRepeatModeNone;
    CGRect f = self.view.frame;

    if ([self systemMajorVersion] < 7) {
        controller.view.frame = CGRectMake(0,0,f.size.width, f.size.height);
    }else{
        controller.view.frame = CGRectMake(0,0,f.size.width, f.size.height - self.tabBarController.tabBar.frame.size.height);
    }

    [self.view addSubview:controller.view];
    controller.allowsAirPlay = YES;
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(exitFullScreen:) name:@"MPMoviePlayerDidExitFullscreenNotification" object:controller];
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(enterFullScreen:) name:@"MPMoviePlayerWillEnterFullscreenNotification" object:controller];
}
}

在我实施CJPAdController库之前,此工作正常,这是处理广告的绝佳工具。基本上,我在标签栏控制器下方的底部添加了广告,当视频从全屏退出时,状态栏仍然隐藏,我无法再显示它。这只发生在iOS 7上,在iOS 6上运行正常。

我尝试了以下内容:

- (void)exitFullScreen:(NSNotification *)notification{
[controller pause];
    NSLog(@"%hhd",[UIApplication sharedApplication].statusBarHidden);
    [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleDefault];
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
    [self setNeedsStatusBarAppearanceUpdate];
    NSLog(@"%hhd",[UIApplication sharedApplication].statusBarHidden);
}

它总是打印“1”。

我还将以下内容添加到标签栏控制器和导航控制器

- (BOOL)prefersStatusBarHidden {
    return NO;
}

还尝试使用IOS 6 - Status Bar Not Showing after Playing videoiOS 7 Status Bar Disappears After Playing a Video

0 个答案:

没有答案