Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. -(void)playAnimations:(NSString*)animationName:(int)photoCount
  2. {
  3.  
  4. NSString *photoPathName;
  5. UIImage *object = [[UIImage alloc]init];
  6.  
  7. for (int i=1; i<photoCount+1; i++)
  8. {
  9. NSString *imagesName=@"";
  10. if (i<10) {
  11. imagesName =[photoPathName stringByAppendingFormat:@"000%d",i];
  12. }
  13. else if(i>9 && i<100)
  14. imagesName =[photoPathName stringByAppendingFormat:@"00%d",i];
  15. else if(i>99 && i<1000)
  16. imagesName =[photoPathName stringByAppendingFormat:@"0%d",i];
  17.  
  18. object = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imagesName ofType:@"png"]];//[UIImage imageNamed:imagesName];
  19. [self.arrayImagesName addObject:object];
  20.  
  21. }
  22. self.animationImage.animationImages = self.arrayImagesName;
  23.  
  24. self.animationImage.animationDuration =durationTime ;// defaults is number of animation images * 1/30th of a second
  25. self.animationImage.animationRepeatCount = 1; // default is 0, which repeats indefinitely
  26. [self.animationImage startAnimating];
  27. }
  28.  
  29. UIImage *object = [[UIImage alloc]init];
  30.  
  31. for (int i=1; i<photoCount+1; i++)
  32. {
  33. // some code
  34. UIImage *object = [[UIImage alloc]initWithContentOfFile:[[NSBundle mainBundle] pathForResource:imagesName ofType:@"png"]];
  35. [self.arrayImagesName addObject:object];
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement