引入 #import <QuartzCore/QuartzCore.h>
公有方法实现
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:1.0f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:subview2 cache:YES];
//最后启动动画
[UIView commitAnimations];
以下是私有方法实现
// CATransition *transition = [CATransition animation];
// transition.duration = 1.0f;
// transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
// transition.type = @"pageUnCurl";
// transition.subtype = kCATransitionFromRight;
// transition.delegate = subview2.layer;
// [subview2.layer addAnimation:transition forKey:nil];
函数讲解
//首先设置动画的相关参数
[UIView beginAnimations:@"Curl"context:nil];