我在iOS 7中实现了这段代码,运行得非常完美,但在iOS 8中却无法正常工作。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeStarted:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeFinished:) name:@"UIMoviePlayerControllerWillExitFullscreenNotification" object:nil];
-(void)youTubeStarted{
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
appDelegate.fullScreenVideoIsPlaying = YES;
}
-(void)youTubeFinished{
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
appDelegate.fullScreenVideoIsPlaying = NO;
}
我已经尝试将UIMoviePlayerControllerDidEnterFullscreenNotification更改为MPMoviePlayerWillEnterFullscreenNotification。但是没有成功。
还有别的方法吗?
编辑
看看使用NorthBlast的答案后,我认为在iOS 8.1上会发生什么。 它在iOS 8.0和iOS 8.0.2上完美运行。