2013-04-02 75 views
0

我想以全屏方式在UIWebView中播放YouTube視頻(風景模式) 但我所有的其他視圖只能在肖像模式下使用。如何纔有可能只有YouTube視頻處於橫向模式?UIWebView - YouTube視頻風景模式 - iOS6

是否必須在應用目標摘要中啓用橫向模式?

感謝您的幫助! :-)

+0

我可以建議的一件事是,轉換並旋轉90度旋轉視角。它只針對你的webview屏幕。也可以使用自動佈局或自動調整子視圖屬性來相應地調整您的webview的大小。 – Mrunal

+0

發佈問題前閱讀[UIViewController](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html)的文檔。 – nsgulliver

回答

1

如果您的應用程序使用多個方向,則需要在Project Target摘要中定義它們。例如肖像,風景左&風景權。

如果您的設備適用於iOS5,請使用以下方法(在iOS6中棄用)旋轉到特定方向。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

如果您使您的設備在iOS6上工作。你應該使用下面的方法。

– shouldAutorotate – supportedInterfaceOrientations & – preferredInterfaceOrientationForPresentation

如果您的應用支持兩個版本,那麼你可以保持兩個方法,並檢查您的視圖控制器由

if ([self respondsToSelector:@selector(methodToCheck)]) 
1
myTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; 

CGAffineTransform rotate = CGAffineTransformMakeRotation(1.57079633); 
[myTableView setTransform:rotate]; 
self.view = myTableView; 

這也將努力應對的具體方法*

確保在這裏我已經在桌面上做了​​