1

現在、ユーザーがデバイスを横向きに回転させたときに、ある画面から別の画面に移行したいアプリに取り組んでいます。私はこれを機能させていますが、トランジション中の画面は、次のビューが入ってくるのと同じように横向きに回転します。現在のビューが回転しないようにする一般的な解決策は、shouldAutoRotate メソッドに対して NO を返すことです。ただし、次の画面に遷移するには、これを有効にする必要があります。willRotateToInterfaceOrientation で [UIView setAnimationsEnabled:NO] も試しましたが、これはアニメーションを非表示にするだけで、現在のビューを横向きに回転させます。関連するすべての回転メソッドを次に示します。

-(BOOL)shouldAutorotate
{
        return YES;
}

//Temporarily disable rotation animation
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
    [UIView setAnimationsEnabled:NO];
}

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    [UIView setAnimationsEnabled:YES];

    if(UIInterfaceOrientationLandscapeLeft)
        [self performSegueWithIdentifier:@"landscapeView" sender:self];
}


-(NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAllButUpsideDown;
}

助言がありますか?前もって感謝します。

4

1 に答える 1

0

向き/サイズの変更に応答しないように、回転時にアニメーション化するビューを構成する必要があります。たとえば、自動レイアウト (新しいテクノロジ) を使用していない場合は、Interface Builder の自動レイアウト設定、またはおそらくストラット/スプリング設定を参照してください。

于 2013-03-03T09:20:32.670 に答える