2012-10-08 23 views
2

我目前使用的MPMoviePlayerController並添加它以一個的UIViewController我敢用呈現:解聘的MPMoviePlayerController,模式上RootViewController的iOS6的

UIViewController *rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController]; 
[rootViewController presentModalViewController:viewController animated:YES]; 

當我使用駁回modalviewcontroller:

UIViewController *rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController]; 
[rootViewController dismissModalViewControllerAnimated:YES]; 

一切都保持黑色。

這在iOS5上運行良好。另一個沒有使用電影播放器​​的modalviewcontroller仍然在iOS6上罰款。

我試過了[self.view.window.rootViewController dismissViewControllerAnimated:YES completion:nil];函數,但是這並沒有改變任何東西。

回答

0

我會建議使用presentViewController而不是presentModalViewController。這適用於iOS 5和iOS 6,而來自iOS 6的presentModalViewController已棄用。它可能無法完全解決您的問題,但它是更好的代碼練習。

另一件事:代替使用MPMoviePlayerController並將其添加到視圖控制器來顯示,爲什麼不使用MPMoviePlayerViewController?所有在一個包。

如果那仍然不解決它,張貼更多的數據,你可以更容易地幫助。

+0

我把它放在另一個視圖中的原因是因爲視圖需要保持肖像,但視頻可能在橫向。我已經通過在iOS6中添加「去/退出全屏」觀察者來修復它。 iOS6中的視頻仍會全屏顯示,但不會以縱向模式播放。不完全是我想要的,但它會做。 – Thomas

+0

嗯......好吧,請注意,如果您以模態方式呈現視圖控制器,則可以確定它所處的方向,而與應用程序其餘部分的方向無關。例如,在iOS 6中,我認爲這是通過'preferredInterfaceOrientationsForPresentation'完成的。據我所知,你可以讓視頻旋轉到肖像和風景,同時保持你的應用程序的其餘部分鎖定在肖像(這聽起來像你想要的,但它不完全清楚)。 –

相關問題