iphone view与view翻转的动画效果

- (void)onSwitchViews:(id)sender  

{  

if (secondViewController == nil)  

{  

ContitionSelectorPage *tempViewController = [[ContitionSelectorPage alloc] initWithFrame: CGRectMake(0, 44, self.view.frame.size.width,  self.view.frame.size.height-44) ];                  

secondViewController = [tempViewController retain];  

[tempViewController release];  

}  

[UIView beginAnimations:@"View Flip" context:nil];  

[UIView setAnimationDuration:1.25];  

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  

UIViewController *coming=nil;  

UIViewController *going=nil;  

UIViewAnimationTransition transition;  

if (firstViewController.view.superview == nil)   

{          

coming=firstViewController;  

going=secondViewController;  

transition=UIViewAnimationTransitionFlipFromRight;                  

}  

else  

{  

coming=secondViewController;  

going=firstViewController;  

transition=UIViewAnimationTransitionFlipFromLeft;  

}  

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

[coming viewWillAppear:YES];  

[going viewWillDisappear:YES];  

[going.view removeFromSuperview];  

[self.view insertSubview:coming.view atIndex:0];  

[coming viewDidAppear:YES];  

[going viewDidDisappear:YES];  

[UIView commitAnimations];  

}  

原文地址:https://www.cnblogs.com/luyinghuai/p/2103127.html