iOS: 动画更换 UIImageView 的 Image

#import <QuartzCore/QuartzCore.h>
...
imageView.image = [UIImage imageNamed:(i % 2) ? @"3.jpg" : @"4.jpg"];

CATransition *transition = [CATransition animation];
transition.duration = 1.0f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade;

[imageView.layer addAnimation:transition forKey:nil];

链接:http://stackoverflow.com/a/2834693(Stack Overflow)

posted @ 2014-04-04 13:06  有妄想症的猫zz  阅读(2933)  评论(0编辑  收藏  举报