Guest User

Untitled

a guest
May 18th, 2015
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. - (IBAction)playButton:(id)sender {
  2.  
  3. NSLog(@"play Button clicked");
  4. if(self.mainloop)
  5. {
  6. [self.mainloop invalidate];
  7. self.mainloop = nil;
  8. [_animationView stopAnimating];
  9. }
  10. else{
  11. self.mainloop = [NSTimer scheduledTimerWithTimeInterval:0.5
  12. target:self
  13. selector:@selector(mainloop:)
  14. userInfo:nil
  15. repeats:YES];
  16. }
  17.  
  18. }
  19.  
  20. -(void)mainloop:(NSTimer *)timer
  21. {
  22. [self flashEffect:timer];
  23. [self animatioEffect:timer];
  24. }
  25.  
  26. -(void)animatioEffect:(NSTimer *)timer
  27. {
  28.  
  29. NSArray *animationImagesArray = @[[UIImage imageNamed:@"1.jpg"],
  30. [UIImage imageNamed:@"2.jpg"],
  31. [UIImage imageNamed:@"3.jpg"],
  32. [UIImage imageNamed:@"4.jpg"]];
  33.  
  34. _animationView.animationImages = animationImagesArray;
  35. _animationView.animationDuration = 4 ;
  36. [_animationView startAnimating];
  37. }
Advertisement
Add Comment
Please, Sign In to add comment