xl19880619
xl19880619

Reputation: 11

how to push a viewController with flip animation

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
alarmViewController = [[AlarmViewController alloc] init];
[self.navigationController pushViewController:alarmViewController animated:YES];
[alarmViewController release];
[UIView commitAnimations];

I just want the viewcontroller flip like opening a book page,but it does not work like this.And I have a question that whether navigationController can animate this effect?

Upvotes: 1

Views: 1920

Answers (1)

Srikar Appalaraju
Srikar Appalaraju

Reputation: 73718

Since you are already putting the navigationController in an animation block. Mark animated:NO -

[self.navigationController pushViewController:alarmViewController animated:NO];

when we actually call pushViewController: we are setting the animated value to NO. This disables the Navigation Controller's default animation. Instead, the block of code uses the defined transition.

Upvotes: 1

Related Questions