Flip transitions viewed from above in landscape mode

I use this code for redeployment.

MyViewController *viewController = [[MyViewController alloc] init];

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:YES];
[self.navigationController pushViewController:viewController animated:NO];
[UIView commitAnimations];
[viewController release];

But instead of leaning to the right, its flipping over. My application works only in landscape mode.

Please, help.

+3
source share
2 answers

Animation constants were determined based on portrait mode. If you define your application only in landscape mode, you should think about these animation constants by tilting your head 90 degrees.

Suppose the top of your device is indicated on the left, than you set the animation with

[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:YES];

and it will curl to the right. This is because in this case the bottom of the device is facing right.

, UIViewAnimationTransitionFlipFromBottom . , 90 , .

0

, Apple , API. , :

// Assume this code is in a view controller subclass
- (UIViewAnimationOptions)viewAnimationOptionTransitionFlipFromRight
{
    switch (self.interfaceOrientation) {

        case UIInterfaceOrientationPortrait:
            return UIViewAnimationOptionTransitionFlipFromRight;

        case UIInterfaceOrientationLandscapeLeft:
            return UIViewAnimationOptionTransitionFlipFromBottom;

        case UIInterfaceOrientationLandscapeRight:
            return UIViewAnimationOptionTransitionFlipFromTop;

        case UIInterfaceOrientationPortraitUpsideDown:
            return UIViewAnimationOptionTransitionFlipFromLeft;
    }
}

, . , , , .

+1

All Articles