Question

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 where your fingers starts on a button?

Any ideas?

Thanks Simon

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top