I'm trying to detect a touch in a UIImageView. I'm trying to make it such that if a user taps on an image, it wil call a method, and if a user taps on another, it will call another method. Here is my code so far:
Just to let you know, I ticked the userInteractionEnabled box for the images in the IB.
So far, it doesn't work. Please help. Even the
statement does not do anything, signifying that it didn't respond to the touch at all.
Code:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch* touch = [touches anyObject];
if ([touch view] == self.imageView1){
[self doAMethod];
NSLog(@"Touched!");
}
else if ([touch view] == self.imageView2){
[self doAnotherMethod];
}
else if ([touch view] == self.imageView3){
[self doYetAnotherMethod];
}
else if([touch view] == self.imageView4){
[self doADifferentMethod];
}
}
So far, it doesn't work. Please help. Even the
Code:
NSLog