动画
从各个地方找来的,有三种:
第一种:
CGContextRef context = UIGraphicsGetCurrentCont
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEase
[UIView setAnimationDuration:kDuration];//动画时间
[UIView setAnimationTransition:UIViewAnimationTransitio
NSUInteger green = [[self.view subviews] indexOfObject:self.greenView];
NSUInteger blue = [[self.view subviews] indexOfObject:self.blueView];
[self.view exchangeSubviewAtIndex:green withSubviewAtIndex:blue];
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
第二种:
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = kDuration;
animation.timingFunction = UIViewAnimationCurveEase
animation.type = kCATransitionFade;//动画类型
animation.subtype = kCATransitionFromLeft;//动画方向
NSUInteger green = [[self.view subviews] indexOfObject:self.greenView];
NSUInteger blue = [[self.view subviews] indexOfObject:self.blueView];
[self.view exchangeSubviewAtIndex:green withSubviewAtIndex:blue];
[[self.view layer] addAnimation:animation forKey:@"animation"];
动画类型还有:
- 2.用字符串表示
-
pageCurl 向上翻一页 -
pageUnCurl 向下翻一页 -
rippleEffect 滴水效果 -
suckEffect 收缩效果,如一块布被抽走 -
cube 立方体效果 -
oglFlip 上下翻转效果
-
cameraIrisHollowOpen iphone相机打开效果
-
cameraIrisHollowOpen 关闭相机的效果
- */
第三种:
[UIView animateWithDuration:1 animations:^{
还有其他类型的调用方法,这个是最简单的,可以加上其他的参数进行一些操作。
第二个参数是一个代码快,来执行VIEW的属性改变,系统会将视图从当前状态平滑的过度到最终状态(就是你做修改之后的状态)。
可以被改变的属性有:
frame
bounds
center
transform //可以实现3D/2D效果
alpha
backgroundColor
contentStretch
比如 self.view.layer.transform = CATransform3DMakeRotatio
上面是3D变化,如果是2d的,那么就应该修改view上的transform