2014-09-22 58 views
0

應用程序的所有頁面應處於potrait模式。但在一個特定的頁面中,我正在webview中加載一個you tube視頻。當點擊視頻時,我在mpmovie播放器控制器中顯示視頻,我希望在橫向模式下播放。我怎樣才能做到這一點?任何幫助將非常感激。我希望我的應用程序在potrait模式下的所有視圖控制器,但在橫向模式下的特定視圖控制器

+0

也許,在這裏你可以找到答案 http://stackoverflow.com/questions/20372223/maintain一個視圖中的控制器在縱向和其他在景觀模式 - ios http://stackoverflow.com/questions/16392021/first-uiview-in-portrait-orientation-and-second-in -landscape?rq = 1 – Oleshko 2014-09-22 08:04:42

+0

檢查我的答案爲類似的問題 - http://stackoverflow.com/questions/23491426/ios-7-how-to-allow-only-portrait-orientation-for-vc/23491583#23491583 – Bharat 2014-09-22 11:59:09

回答

0

你如果你使用的故事板,你可以只選擇你的觀點就擺在您的視圖控制器的viewDidLoad這行,你需要在橫向模式我認爲這會工作...

if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) { 
    objc_msgSend([UIDevice currentDevice], @selector(setOrientation:), UIInterfaceOrientationLandscapeLeft); 
} 
+0

它也不適合我 – Rafay 2014-09-22 11:00:32

+0

檢查我編輯的答案... – 2014-09-22 11:52:07

0

並且在屬性檢查器中,您可以選擇所需的方向(而不是「推斷的」)。

如果你在故事板是不是我敢肯定,你可以使用這樣的事情

webview.orientation = UIOrientationPortrait (haven't tried it but it must be pretty similar) 
+0

我沒有找到webview的方向屬性.. – Rafay 2014-09-22 10:59:24

+0

這有幫助嗎? http://stackoverflow.com/questions/2325795/webview-resizes-automatically-to-portrait-and-landscape-view-in-iphone 它關於調整webview一次旋轉,所以你應該能夠看到它是如何與shouldAutorotateMethod一起旋轉。但它需要測試,我現在沒有時間,我只是想找一條路向你展示 – 2014-09-22 11:38:53

相關問題