问题
[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?
回答1:
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.
来源:https://stackoverflow.com/questions/7266144/how-to-push-a-viewcontroller-with-flip-animation