I have an outlet called myImage
for an imageView that is set up with an animation of 5 images. With a Tap Gesture Recognizer on it, I want to have the users tap on the correct image as it quickly passes to move onto the next level.
There is an error in my code and this does not work:
- (void)viewDidLoad {
[super viewDidLoad];
self.myImage.animationImages =
[NSArray arrayWithObjects:
[UIImage imageNamed:@"examplePic1.png"],
[UIImage imageNamed:@"examplePic2.png"],
[UIImage imageNamed:@"correctPic.png"],
[UIImage imageNamed:@"examplePic4.png"],
[UIImage imageNamed:@"examplePic5.png"],
nil];
[self.myImage setAnimationRepeatCount:0];
self.myImage.animationDuration = 1;
[self.myImage startAnimating];
}
- (IBAction)TapGestureRecognizer:(id)sender {
if (self.myImage.image = [UIImage imageNamed:@"correctPic.png"]) {
// Launch next level
}
else {
// Vibrate Device and subtract points from score
}
}