AbelYuLBB
帅气如我
2016-08-07 18:13

iOS中序列帧动画,执行一次动画的时间不一样是什么情况?

代码如下:
-(void)TomAnimationwithImageCount:(NSInteger)num andImageName:(NSString *)names{
if([self.TomImage isAnimating])return;
NSMutableArray *nmArray = [NSMutableArray array];
for(int i = 0; i< num-1;i++){
NSString * name = [NSString stringWithFormat:@"%@_%02d.jpg",names,i];

NSString * path = [[NSBundle mainBundle]pathForResource:name ofType:nil];
UIImage * imageTom = [UIImage imageNamed:path];
[nmArray addObject:imageTom];
}
//设置图片数组动画
self.TomImage.animationImages = nmArray;
self.TomImage.animationDuration = 3;
self.TomImage.animationRepeatCount = 1;
[self.TomImage startAnimating];
[self performSelector:@selector(StopTomAnimation) withObject:nil afterDelay:self.TomImage.animationDuration +1];

}
-(void)StopTomAnimation{
self.TomImage.animationImages =nil;
}

//我反复试验过,实在是找不到问题出在哪里,求大神帮忙解决一下。

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答