【转】CATransition的动画效果类型及实现方法
实现iphone漂亮的动画效果主要有两种方法,一种是UIView层面的,一种是使用CATransition进行更低层次的控制,
第一种是UIView,UIView方式可能在低层也是使用CATransition进行了封装,它只能用于一些简单的、常用的效果展现,这里写一个常用的示例代码,供大家参考。
// Curl the image up or downCATransition *animation = [CATransition animation];[animation setDuration:0.35];[animation setTimingFunction:UIViewAnimationCurveEaseInOut];if (!curled){//animation.type = @"mapCurl";animation.type = @"pageCurl";animation.fillMode = kCAFillModeForwards;animation.endProgress = 0.99;} else {//animation.type = @"mapUnCurl";animation.type = @"pageUnCurl";animation.fillMode = kCAFillModeBackwards;animation.startProgress = 0.01;}[animation setRemovedOnCompletion:NO];[view exchangeSubviewAtIndex:0 withSubviewAtIndex:1];[view addAnimation:animation forKey"pageCurlAnimation"];// Disable user interaction where necessaryif (!curled) { } else { }curled = !curled;