您的位置:首页 > 产品设计 > UI/UE

图片数组形成动画(UIImageView)

2015-11-21 11:24 417 查看
图片数组形成动画(UIImageView)

UIImage *image = [UIImage imageNamed:@"iphone"];

//创建UIImageView来显示图片

self.firstImageView = [[UIImageView alloc] initWithImage:image];

self.firstImageView.frame = CGRectMake(100, 100, 79 , 106);



//图片动画

NSMutableArray *images = [NSMutableArray array];

for (int i = 1 ; i < 41; i++) {

UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"2250_3650903_179fb89ae279fae-%d(被拖移).tiff",i]];

[images addObject:image];

}

//设置图片动画的图片数组

self.firstImageView.animationImages = images;



//设置图片动画的持续时间

self.firstImageView.animationDuration = 2;



//设置图片动画的重复次数(默认是0,代表无数次)

self.firstImageView.animationRepeatCount = 0;



//开始图片动画(停止用stop)

[self.firstImageView startAnimating];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: