2012-03-12 16 views
5

内のUIWebViewユーチューブからだけのアプリに戻り、私はiOS applicationを作成していると私は、次のような問題が発生しました:iOSの肖像画風景

プロジェクトはportraitモードのアプリケーションに設定されています。 私はUIWebviewを持っています。このウェブページにはyoutubeのビデオが入っています。動画がクリックされると、youtube playerで開始されます。動画がlandscapeモードに変更され、「完了」をクリックするとUIWebviewに戻り、landscapeに表示されます。

ビデオが終了したときに私はNSNotificationを受け取るが、私はportraitモードを強制することができない。

これは可能ではありません。私はyoutubeをlandscapeにすることを許可するにはどうすればよいですか?portraitモードにとどまるようアプリを強制しますか?または、別の回避策がありますか?

EDIT:

Appleと接触した後、それはバグであることが判明して報告されます。

+1

UIWebViewからどのようにyoutubeプレーヤーを景色に見せるようにしましたか? –

答えて

0

は、私はあなたが

2
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait]; 

がプライベートAPIであるのに役立ちます肖像画

- (void)YourMethodCalledByNSNotification 
{ 
    UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; 

    if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight || orientation == UIInterfaceOrientationPortraitUpsideDown) 
    { 
     [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait]; 
    } 
} 

希望にビューを強制的に今のコード行を使用し、あなたが言ったようにNSNotificationを使用すると呼ばれる方法でできると思います。私はそれを使用することをお勧めしません。

UIWindow *window = [[UIApplication sharedApplication] keyWindow]; 
    UIView *view = [window.subviews objectAtIndex:0]; 
    [view removeFromSuperview]; 
    [window insertSubview:view atIndex:0]; 

私はずっと考えています。これは、アプリの向きを強制的に調整します。

関連する問題