2014-09-11 69 views
5

在我的應用程序中,我加載了一些嵌入了照片和視頻的網頁。另外我使用下列通知來管理球員,UIWebView嵌入視頻回調不適用於iOS8?

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(embeddedVideoStarted:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil]; 
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(embeddedVideoEnded:) name:@"UIMoviePlayerControllerWillExitFullscreenNotification" object:nil]; 

這在iOS7工作正常,但在iOS8上它不工作。任何解決方法?提前致謝。

回答

4

這是一個選項,我發現..這個問題是不是威爾確實成爲隱藏..

[[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(embeddedVideoStarted:) 
               name:UIWindowDidBecomeVisibleNotification 
               object:self.view.window]; 

[[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(embeddedVideoEnded:) 
               name:UIWindowDidBecomeHiddenNotification 
               object:self.view.window]; 

如果我找到我將它貼在第二通知修復.. :)

+0

你找到了解決辦法? DidBecomeHidden爲屏幕取向已經太晚了... – Boaz 2014-11-05 19:57:53

+0

你可以得到背面的方向..你可能想看看[this - >](http://stackoverflow.com/questions/26611646/ios7-ios8-allow-only-portrait-in-view-controller/26612748#26612748)或[here->](http://stackoverflow.com/questions/26694955/properly-force-or-allow-landscape- mode-for-youtube-embedded-video-in-ios-8-witho)我希望它有幫助! – NorthBlast 2014-11-05 20:16:12

+0

我實現了這樣一個解決方案,但問題是supportedInterfaceOrientationsForWindow在UIWindowDidBecomeHiddenNotification之前被調用。而視頻背後的屏幕則是風景。我需要以某種方式手動調用UIWindowDidBecomeHiddenNotification – Boaz 2014-11-05 20:18:29