0

呼び出しはUIInterfaceOrientationデリゲートメソッドに入りません助けてください

これがコードです

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return YES;
}

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
    {
        NSLog(@"potrait");
    }
    else
    {

    }
}
4

2 に答える 2

4

ビューコントローラは別のビューコントローラ内にありますか?

技術的なQ&Aを探す QA1688 UIViewControllerがデバイスと一緒に回転しないのはなぜですか?開発者向けドキュメント

それはあなたの場合にそれが機能しない理由のヒントをあなたに与えるでしょう。

于 2011-02-09T13:39:01.740 に答える
1

私は先週この問題を抱えていました、そしてここに私が発見したものがあります。タブバーを使用している場合は、

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return YES;
}

それらのいずれかを回転させるためにTabBarControllerに追加されるすべてのViewControllerで。特定のタブのみを回転させたい場合でも、追加することでこれを実現できます

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
}

NavigationControllerを使用している場合も同様の解決策がある可能性がありますが、私はまだその問題に遭遇していません。

于 2011-02-09T13:38:38.090 に答える