So I have this UIWindow that has some custom properties. I also have a transparent UIWebView on top of this window. Now I have embedded a youtube video. Problem is when the user presses the video it starts off and everything but the custom properties of the UIWindow is still visible while the Youtube video plays.
Anyone knows how I can get notified when the user starts the开发者_高级运维 youtube video and can hide my customizations on the parent view?
Note, the Youtbe video is embedded using HTML. This is NOT using the native YouTube.app.
I think you're maybe missing a UIView layer. Like your hierarchy should be UIWindow->UIView->UIWebView, and your customization should happen on the UIView layer of that. That could be your problem.
What custom properties stay visible? You shouldn't need to be notified of the in-app youtube player appearing. It is presented as a modal view controller.
You can use these notifications
-(void)addWebViewPlayNotifications{
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(windowNowVisible:)
name:UIWindowDidBecomeVisibleNotification
object:self.view.window
];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(windowNowHidden:)
name:UIWindowDidBecomeHiddenNotification
object:self.view.window
];
}
-(void)removeWebViewPlayNotifications{
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:UIWindowDidBecomeVisibleNotification
object:self.view.window
];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:UIWindowDidBecomeHiddenNotification
object:self.view.window
];
}
精彩评论