I have a UIView
with two UIButton
s on each side (left and right) and a UIImageView
in the center. A tap on either button will change the UIImageView
and that works. I want the ability swipe across the UIView
as well and it change UIImageView
. Right now, you have to swipe on the UIImageView
itself since the UIButton
s are catching the input.
I'd like to be able to perform a swipe anywhere on the containing UIView
and it performs the transition. Is there a way to forward touch events such that a swipe can trigger an action, but any other touch is forwarded to the proper subviews?
Set delaysTouchesBegan
to YES
on the gesture recognizer, which will make it only forward touch events to subviews if a gesture is not recognized.
How do you currently have the UIButtons set up to receive the input? Make sure that the selector you are hooking up the UIButton is hooked up with "Touch Up Inside". This should ensure that a swipe that begins on one of the buttons does not actually activate the button (assuming the user swipes all the way off the button).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With