質問

私は非常に簡単なものしているのか教えてください問題にしています。か設定します。plistする眺めのようですが、無視します。実際、このアプリは、荷重のシミュレーターは眺めのよいが、それを返します縦画面でモードになります。

この階層のコントローラ:

  • MainViewController(広UITabBarControllerにオーバーライドshouldAutorotateToInterfaceOrientation:)
    • 三拡張UITableViewControllersタブとしてもそのshouldAutorotateToInterfaceOrientation正しく設定。

だって見ました。力の向き装置風景:

[[UIDevice currentDevice]setOrientation:UIInterfaceOrientationLandscapeRight];

その一瞬のシミュレーターが点滅表示モードでは、そこから眺めのよい.問題はこのように、自動回転アニメが開始しかできないtollerate.いうの固定には、手入れの行き届いた。

他のヒン?私何かが足りない?

役に立ちましたか?

解決

次のことを試してみてください。それはあなたのために動作しない理由はわからない。

1)キーUIInterfaceOrientation
を設定 UIInterfaceOrientationLandscapeRightにあなたの.plistファイルの

2)あなたのUITabBarController shouldAutorotateToInterfaceOrientation()メソッドをオーバーライドします。次のコードは、タブのみゼロとし、唯一のコントローラと1を扱うには:あなたはナビゲーションコントローラを持っていて、スタック上にあってもよい異なるコントローラを制御したい場合は、あなたがそれに応じてコードを変更する必要があります。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    BOOL tabZeroController = [[[self.viewControllers objectAtIndex:0] visibleViewController] isKindOfClass:[YourTabZeroTableViewController class]];

    BOOL tabOneController = [[[self.viewControllers objectAtIndex:1] visibleViewController] isKindOfClass:[YourTabOneTableViewController class]];


    if(self.selectedIndex == 0 && tabZeroController)
        return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

    if(self.selectedIndex == 1 && tabOneController)
        return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

    return NO;

}

2)の設定

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];

あなたのデリゲートのapplicationDidFinishLaunchingに()メソッドは、だけでなく、デバイス上で、シミュレータに必要とされる。

3)お使いのコントローラで次のshouldAutorotateToInterfaceOrientation(メソッド)を追加

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
   return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

4)お使いのデバイス上でアプリケーションを実行し、それがハードウェアのメニュー項目左回転と右回転を使用して正常に動作することを確認します。あなたは、ランドスケープモードでの表示を確認する必要があります。

他のヒント

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top