I trying to make a swipe mechanism for a view that might have buttons on it. Without a button its a piece of cake.
However if your finger starts on the button, you can trigger an event (drag outside) but that does not tell me the direction.
So how can I detect the direction of a swipe / drag w开发者_开发问答here your fingers starts on a button?
Any ideas?
Thanks Simon
It's still easy you just don't use the drag outside event. Look at the hitTest:withEvent
in UIView to determine if it starts in the button or not. Along with UISwipeGestureRecognizer (or the touch event stuff) you should be fine.
Check out UISwipeGestureRecognizer
. You ought to be able to just add it to your main view and have it recognize the gesture whether or not it originates on a button.
精彩评论