Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. - (void) startImageViewAnimation:(UIImageView *)imageView WithImages:(NSArray*)imageArray orBuildArrayWithImage:(NSString *)imageName duration:(CGFloat)duration repeatCount:(NSInteger)repeatCount soundFile:(NSString *)soundFile stopSoundAfterDuration:(CGFloat) stopSoundDuration
  2. {
  3.  
  4. if([imageName length] != 0)
  5. {
  6. NSMutableArray *array = [[NSMutableArray alloc] init];
  7. UIImage *image;
  8. int index = 1;
  9. NSString *string;
  10. do
  11. {
  12. string = [NSString stringWithFormat:@"%@%02d.png", imageName, index++];
  13. image = [UIImage imageNamed:string];
  14. if(image)
  15. [array addObject:image];
  16. } while (image != nil);
  17.  
  18. imageView.animationImages = array;
  19. [array release];
  20. }
  21. else
  22. {
  23. imageView.animationImages = imageArray;
  24. }
  25. imageView.animationDuration = duration;
  26. imageView.animationRepeatCount = repeatCount;
  27. [imageView startAnimating];
  28.  
  29. if([soundFile length] != 0)
  30. {
  31. [self loadSoundEffectAudio:soundFile];
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement