欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

UIImageView实现动画

程序员文章站 2024-01-19 12:32:46
...
UIImageView  * Animation = [UIImageView alloc] initWithFame:[UIScreen mainScreen] bounds]];
[self.view  addSubview:Animation];
//设置动画帧
Animation.animationImages=[NSArray arrayWithObjects:
[UIImage imageNamed:@"1.jpg"],
[UIImage imageNamed:@"2.jpg"],
[UIImage imageNamed:@"3.jpg"],
[UIImage imageNamed:@"4.jpg"],
[UIImage imageNamed:@"5.jpg"],nil ];
//设置动画总时间
Animation.animationDuration=1.0;
//设置重复次数,0表示不重复
Animation.animationRepeatCount=0;
//开始动画
[Animation startAnimating];    

使用延时来完成动画结束时的回调

  [self performSelector:@selector(doOtherAction) withObject:nil afterDelay:ANIMATION_TIME];