UIImageView实现动画

2016-06-28  本文已影响29人  逆战逆的态度
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];
上一篇下一篇

猜你喜欢

热点阅读