Prevent UIButton touch event for multitouch
after finding out that there is a bug in the UITapGestureRecognizer ( How to cancel button tap if UIGestureRecognizer fires? ) I am thinking about detecting two finger taps and two finger double-taps in the touchesEnded method of my view controller.
Here is the situation, what I want to do and my problem:
Situaion: I have a UIView, managed by a UIViewController. This view contains multiple UIButtons that react to taps.
What I want: I want to react to two finger taps and to two finger double-taps on my view but also to one finger taps on the UIButtons.
Problem: Once a button is tapped (even if using two fingers on the view) the touchesEnded method on my view controller isn't called anymore. How can I cancel button taps when more than one finger is used?
I already tried to subclass UIView and use the hitTest method, but the touches property of the event is always empty in this. Also I tried to overlay the buttons with a transparent UIView, but this also cancel开发者_运维知识库s the button touches.
@Mark I was trying to get your example from the other day working. As it is a bug, I altered it to use a tap recognizer. It's not a true solution as you don't get a clicked effect on the button but the right button messages the Touch Up Inside
event. You can check out those changes here
. See if it helps.
精彩评论