UIImageView *animationView = [[UIImageView alloc]initWithFrame:CGRectMake(40, 22.5, 15, 15)];
//未开始的图片
animationView.image = [UIImage imageNamed:@"icon_animation_01"];
//动画效果图片(按照播放顺序放置)
animationView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"icon_animation_01"],
[UIImage imageNamed:@"icon_animation_02"],
[UIImage imageNamed:@"icon_animation_03"],nil];
//设置动画间隔
animationView.animationDuration = 1;
animationView.animationRepeatCount = 0;
animationView.userInteractionEnabled = NO;
animationView.backgroundColor = [UIColor clearColor];
[self.view addSubview:animationView];
//开始动画
[animationView startAnimating];
//结束动画
[animationView stopAnimating];
网友评论