UIMoviePlayerControllerDidExitFullscreenNotification NSNotification在iOs 8中不起作用

时间:2014-10-13 12:35:50

标签: ios iphone ipad ios8 nsnotificationcenter

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeStarted:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeFinished:) name:@"UIMoviePlayerControllerDidExitFullscreenNotification" object:nil];

UIMoviePlayerControllerDidExitFullscreenNotification NSNotification在iOs 8中不起作用

2 个答案:

答案 0 :(得分:5)

我也面临同样的问题,但最后使用UIWindowDidBecomeVisibleNotificationUIWindowDidBecomeHiddenNotification结束了嵌入式YouTube视频(假设通过查看您的选择器方法名称)

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enteredFullScreen:) name:UIWindowDidBecomeVisibleNotification object:nil];
 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullScreen:)  name:UIWindowDidBecomeHiddenNotification object:nil];

上面是一个补丁工作,(希望这有帮助)

答案 1 :(得分:0)

我使用MPMoviePlayerController并且工作正常。我想根据您的使用情况,您不需要UIMoviePlayerController

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(youTubeFinished)
                                                 name:MPMoviePlayerDidExitFullscreenNotification
                                               object:self.player.moviePlayer];