我想在UIWebView中以全屏模式播放视频后做一些事情。
所以,我想要UIWebView
的消息进入全屏&从全屏退出。
在iOS 7中,我收到以下内容的通知:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(VideoEnterFullScreenHere:)
name:@"UIMoviePlayerControllerDidEnterFullscreenNotification"
object:self.view.window];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(VideoExitFullScreenHere:)
name:@"UIMoviePlayerControllerDidExitFullscreenNotification"
object:self.view.window];
但在iOS 8中,它无法正常工作。
答案 0 :(得分:2)
下面的内容对我有用。 我希望它会帮助别人!
在AppDelegate.m类中,
sqrt(n)
接收它,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowBecameHidden:) name:UIWindowDidBecomeVisibleNotification object:nil];
return YES;
}
谢谢!
答案 1 :(得分:1)
使用AVPlayer通知代替UIMoviePlayer通知。
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerItemInitiated:)
name:@"AVPlayerItemBecameCurrentNotification"
object:nil];