1.使用UIView类函数实现:
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
//UIViewAnimationTransitionFlipFromLeft,
//UIViewAnimationTransitionFlipFromRight,
//UIViewAnimationTransitionCurlUp,
//UIViewAnimationTransitionCurlDown,
//要执行的动作.
[UIView commitAnimations];
2.使用CATransition对象来实现: //公开的API
CATransition *animation = [CATransition animation];
animation.duration = 0.5f;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.type = kCATransitionPush;//kCATransitionMoveIn kCATransitionReveal kCATransitionFade
animation.subtype = kCATransitionFromLeft;//kCATransitionFromRight kCATransitionFromTop kCATransitionFromBottom
[self.view.layer addAnimation:animation forKey:@"animation"];
3.2.使用CATransition对象来实现: //末公开的API
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.5f;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.endProgress =1.0;
animation.removedOnCompletion = NO;
animation.type = @"cube";
//@"suckEffect";@"oglFlip";@"rippleEffect";@"pageCurl";@"pageUnCurl";@"cameraIrisHollowOpen";@"cameraIrisHollowClose";
[self.view.layer addAnimation:animation forKey:@"animation"];