XCDYouTubeVideoPlayerViewController:旋转到UIDeviceOrientationPortrait时退出全屏

时间:2015-07-11 14:32:47

标签: ios objective-c xcode youtube

我为我的iOS项目使用https://docs.newrelic.com/docs/alerts库。我用nonFullScreen模式显示视频,代码为:

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(handleDidChangeStatusBarOrientationNotification:)
                                                 name:UIApplicationDidChangeStatusBarOrientationNotification
                                               object:nil];

当iPhone旋转到横向模式时,我设置FullScreen视频,捕捉旋转当前的ViewController:

- (void)handleDidChangeStatusBarOrientationNotification:(NSNotification *)notification; {

    if ([self.videoPlayer.moviePlayer isFullscreen] && [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) {

        [self.videoPlayer.moviePlayer setFullscreen:NO animated:YES];

    }
}

但是我怎么能在fullScreen视频模式下捕捉旋转XCDYouTubeVideoPlayerViewController? 感谢

我的决定

在这个类中我添加了viewDidLoad observer

{{1}}

执行

{{1}}

1 个答案:

答案 0 :(得分:0)

我认为获取此信息的最简单方法是继承XCDYouTubeVideoPlayerViewController并覆盖didRotateFromInterfaceOrientation:和/或viewWillTransitionToSize:withTransitionCoordinator: