Here is what you can do to get what you need ... In this example, I created 7 views
UITapGestureRecognizer* gestureRecognizer; UIView* myView; for (int i = 0; i < 8; i++) { gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doSomthing:)]; gestureRecognizer.numberOfTapsRequired = 1;
Now you need to implement a method like this
-(void)doSomthing:(id)sender { UIView* temp = [(UITapGestureRecognizer*)sender view];
I think this will help you.
source share