i have several UIImageView, each of them has a tag; and I have an array of Images, what i want to do is: when user tap one of the UIImageView, the app give back the certain
To find out which image has to be touch ,use touchBegan method:
Note: First of all you need to confirm about image view should be userIntrectionEnabled=YES;
Now use this method:
-(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event{
// get touch event
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self.view];
if ([touch view].tag == 800) {
//if image tag mated then perform this action
}
}
You can use switch statement inside touchBegan.