UIWebView にある YouTube ビデオを横向きにしようとしていますが、私のアプリケーションは縦向きにしか設定されておらず、他のものを横向きにしたくありません。ランドスケープのサポートや、他のすべてのビューでランドスケープに no を返すなど、すでに多くのことを試しましたが、機能していません。私のプロジェクトはタブベースのアプリケーションです。ビデオだけでなく、ビュー全体を回転させる必要がある場合、フルスクリーンになったときにYouTubeビデオだけを回転させることができれば(これは自動的に行われます)、素晴らしいでしょう。
1 に答える
0
UIDeviceOrientationDidChangeNotification
コントローラーに通知をサブスクライブさせ、通知を処理するメソッドからUIWebView
ビデオを含むものだけを回転させることができます。
これは次のようになります。
[[NSNotificationCenter defaultCenter] addObserver:self
selector: @selector(handleOrientationChangeNotification:)
name: UIDeviceOrientationDidChangeNotification object:nil];
-(void)handleOrientationChangeNotification:(NSNotification *)notification
{
UIDeviceOrientation currentDeviceOrientation = [[UIDevice currentDevice] orientation];
if (currentDeviceOrientation == UIDeviceOrientationLandscapeRight) {
webView.transform = CGAffineTransformRotateMake(M_PI_2);
webView.bounds = (CGRect){480,320};
webView.center = (CGPoint){240,160};
} else if (...
...
}
于 2013-02-10T19:24:38.917 に答える