gpt4 book ai didi

ios - 如何在 iOS 8 的全屏模式下在 UIWebView Player 中接收通知?

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:00:27 27 4
gpt4 key购买 nike

我想在 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 中,它无法正常工作。

最佳答案

下面的东西对我有用。我希望它能帮助其他人!

在你的 AppDelegate.m 类中,

- (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;
}

并以此接收它,

- (void)windowBecameHidden:(NSNotification *)notification {

UIWindow *window = notification.object;

if (window != self.window) {
NSLog(@"Online video on full screen.");
}
}

谢谢!

关于ios - 如何在 iOS 8 的全屏模式下在 UIWebView Player 中接收通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31470099/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com