Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (IBAction)playButton:(id)sender {
- NSLog(@"play Button clicked");
- if(self.mainloop)
- {
- [self.mainloop invalidate];
- self.mainloop = nil;
- [_animationView stopAnimating];
- }
- else{
- self.mainloop = [NSTimer scheduledTimerWithTimeInterval:0.5
- target:self
- selector:@selector(mainloop:)
- userInfo:nil
- repeats:YES];
- }
- }
- -(void)mainloop:(NSTimer *)timer
- {
- [self flashEffect:timer];
- [self animatioEffect:timer];
- }
- -(void)animatioEffect:(NSTimer *)timer
- {
- NSArray *animationImagesArray = @[[UIImage imageNamed:@"1.jpg"],
- [UIImage imageNamed:@"2.jpg"],
- [UIImage imageNamed:@"3.jpg"],
- [UIImage imageNamed:@"4.jpg"]];
- _animationView.animationImages = animationImagesArray;
- _animationView.animationDuration = 4 ;
- [_animationView startAnimating];
- }
Advertisement
Add Comment
Please, Sign In to add comment