2011-06-21 11 views
3

ランドスケープモードへのUIWebViewから再生をこのように満たされた:自動回転のビデオは、私がのUIWebViewを持って

[myWebView loadHTMLString:@"<iframe src=\"http://www.youtube.com/embed/grTCDFbhKMU\" frameborder=\"0\" allowfullscreen></iframe>" 
baseURL:nil]; 

ビデオが正常に開始しましたが、それは風景モードに切り替えることはできませんされています。

私はすでに懸念のViewControllerでこれを書いている:ビデオは:(

を立ち上げたら、任意のアイデアをコンテンツの向きが、useslessを変更する

- (void)didRotate:(NSNotification *)notification 
{ 
    UIDeviceOrientation orientation = [[notification object] orientation]; 

    if (orientation == UIDeviceOrientationLandscapeLeft) 
    { 
     [self.newsContent setTransform:CGAffineTransformMakeRotation(M_PI/2.0)]; 
    } 
    else if (orientation == UIDeviceOrientationLandscapeRight) 
    { 
     [self.newsContent setTransform:CGAffineTransformMakeRotation(M_PI/-2.0)]; 
    } 
    else if (orientation == UIDeviceOrientationPortraitUpsideDown) 
    { 
     [self.newsContent setTransform:CGAffineTransformMakeRotation(M_PI)]; 
    } 
    else if (orientation == UIDeviceOrientationPortrait) 
    { 
     [self.newsContent setTransform:CGAffineTransformMakeRotation(0.0)]; 
    } 
} 

お役立ち

+0

なぜ、webViewは風景モードでYouTubeのビデオを再生しないのですか?私はlandscに回転するメソッドを使ってサブクラスwebviewを試しました –

答えて

0

あなたがでYESを返す必要がありますか?次の方法:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 

    //All orientations are accepted except for the upsidedown orientation 
    if(interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown) { 
     return YES; 
    } else { 
     return NO; 
    } 
} 

はいそれは回転しません。何も返されなければ回転しません。

+1

私はすでに試しました。それは動作しません。さらに、私はこのメソッドを読んで、それを動作させるためには、アプリケーション内のすべてのViewControllerに対して実装する必要があります。私はアプリ全体をオートローテーションしたくない。 –

+0

回転したくない場合は、NOを返すことができます。しかし、これを使用した後、それは私のために回転しました。 – Manuel

+0

確かに、私の間違い。やってみます。 –

関連する問題