tags:

views:

115

answers:

2

Hello everyone

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

A: 

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.

Noah Witherspoon
+1  A: 

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.

willcodejavaforfood
Thanks for your reply, Yes UISwipeGestureRecognizer worked for me!
Burf2000