0

I have an UIView custom class (m, h, xib) with two buttons on it. This view should receive a touch if I tap on it, so I implemented a UITapGestureRecognizer:

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:customElementView action:@selector(customElementPressed:)];
[customElementView addGestureRecognizer:tapGesture];
[tapGesture release];

This view has even two buttons on it, each with an implemented IBAction on it at a touchUpInside action.

My problem is that the two button's aren't receiving the action, each time I tap on them, the UIView's TapGesture method gets called. How can I "force" somehow these buttons to catch the tap?

MMMM
  • 1,319
  • 1
  • 14
  • 32

1 Answers1

1

Please use the search function before posting a new question. Searching UITapGestureRecognizer and UIButton, would have given you the answer:

https://stackoverflow.com/a/3348532/312312

or you might wanna try this approach first:

https://stackoverflow.com/a/8891030/312312

Community
  • 1
  • 1
Lefteris
  • 14,550
  • 2
  • 56
  • 95
  • Thanks, the second one solved my problem. I don't know how I couldn't find it before, however I looked through the already asked questions. Anyhow, thanks! – MMMM Oct 14 '12 at 10:10