//图片对象
UIImageView *speakerImageView=[[UIImageView alloc] initWithFrame:CGRectMake(15,12,29,29)];
//一个动画从执行到结束的要的时间
speakerImageView.animationDuration=0.4;
//重复次数 0 无数次
speakerImageView.animationRepeatCount=0;
speakerImageView.backgroundColor=[UIColor clearColor];
//适用
speakerImageView.contentMode=UIViewContentModeScaleAspectFit;
//动画经历图片数组(放有图片名)
speakerImageView.animationImages=[[NSArray alloc] initWithObjects:[UIImage imageNamed:@"baby_rremind_one@3x"],[UIImage imageNamed:@"baby_rremind_two@3x"],[UIImage imageNamed:@"baby_rremind_three@3x"],nil];
//开始动画
[speakerImageView startAnimating];
本文介绍如何使用UIImageView在iOS应用中创建并播放一个简单的动画效果。通过设置UIImageView的属性,如animationDuration、animationRepeatCount等,可以定义动画的速度和重复次数。同时,通过animationImages属性指定动画帧的图片数组,并调用startAnimating方法启动动画。

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



