NSArray *images= [NSArray arrayWithObjects:[UIImage imageNamed:@"fish_right1.png"],
[UIImage imageNamed:@"fish_right2.png"], [UIImage imageNamed:@"fish_right3.png"], [UIImage imageNamed:@"fish_right4.png"], [UIImage imageNamed:@"fish_right14.png"], [UIImage imageNamed:@"fish_right15.png"], [UIImage imageNamed:@"fish_right20.png"], nil];
int currentImageIndex=0;
[UIView transitionWithView:self.first_fish duration:2.0
options: UIViewAnimationOptionAllowUserInteraction
animations:^ {
// currentImageIndex = currentImageIndex % images.count;
// currentImageIndex = ++(currentImageIndex % images.count);
[self.first_fish setImage:[images objectAtIndex:currentImageIndex] ];
} completion:^(BOOL finished) {
}
];
[self animation_left];
UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(fish_move:)];
tapped.numberOfTapsRequired = 1;
[self.first_fish addGestureRecognizer:tapped];Add a code snippet to your website: www.paste.org