开发者

iphone view flipping: viewflips from top to bottom instead of right to left

i try to build a app that is in landsscape mode all the time. I did the usual stuff: plist added UIInterfaceOrientation / UIInterfaceOrientationLandscapeRight rotated the XIBs in interface builder with the little arrow in top of view.

my code for launching:
- (void)applicationDidFinishLaunching:(UIApplication *)application {    
        [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
    FlipViewController *flip = [[FlipViewController alloc] initWithNibName:@"FlipViewController" bundle:nil];
    [window addSubview:flip.view];
    [window makeKeyAndVisible];
}

But when i try to do a "UIViewAnimationTransitionFlipFromLeft" the page flips from top to bottom instead of right to left. :-/

This is the code i use to flip the views:

[UIView beginAnimations:@"View Flip" context:nil];
    [UIView setAnimationDuration:1.25];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    UIViewController *coming = nil;
    UIViewController *going = nil;
    UIViewAnimationTransition transition;

    if (self.blueViewController.view.sup开发者_StackOverflow中文版erview == nil) 
    {   
        coming = blueViewController;
        going = yellowViewController;
        transition = UIViewAnimationTransitionFlipFromLeft;
    }
    else
    {
        coming = yellowViewController;
        going = blueViewController;
        transition = UIViewAnimationTransitionFlipFromRight;
    }

    [UIView setAnimationTransition: transition forView:self.view cache:YES];
    [coming viewWillAppear:YES];
    [going viewWillDisappear:YES];
    [going.view removeFromSuperview];
    [self.view insertSubview: coming.view atIndex:0];
    [going viewDidDisappear:YES];
    [coming viewDidAppear:YES];

    [UIView commitAnimations];

"window" seems to have missed the fact, that it is in landsscape-mode. Hmmm. can anyone spot my mistake?


Not possible with documented methods.

You need to use CATransition. (CATransition itself is documented, but the flip transition is not.)

To use the flip transition, set the transition's type to "oglFlip" and set subtype to fromLeft/Top/Right/Bottom.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜