用UIViewAnimation实现动画,代码如下:
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView: scrollView cache:YES];
//还有这几种动画 : UIViewAnimationTransitionFlipFromLeft,UIViewAnimationTransitionCurlUp,UIViewAnimationTransitionCurlDown
[scrollView bringSubviewToFront:[scrollView viewWithTag:selectedIndex]];[UIView commitAnimations];
用CATransition实现动画,代码如下:
CATransition *animation = [CATransition animation];
animation.duration = 1.0;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.type = kCATransitionMoveIn;//还有这几种动画:kCATransitionPush,kCATransitionReveal,kCATransitionFade
animation.subtype = kCATransitionFromRight;//移动方向
[self.view.layer addAnimation:animation forKey:@"animation"];
UIView与CATransition动画实践
本文介绍了如何使用UIViewAnimation和CATransition实现不同类型的动画效果,包括UIView提供的翻转、卷曲等过渡动画以及CATransition提供的推入、淡入淡出等动画类型。
983

被折叠的 条评论
为什么被折叠?



