views:

330

answers:

2

How do i put a swipe gesture in the new iPhone SDK? I'm trying to detect a swipe gesture over a UIImageView? A swipe up and a swipe down?

A: 

Basically you need to override onTouchesBegan and onTouchesEnded. When it begins, record the first position, then at the end compare the last touch to the first touch to see if it is lower or higher.

Matt Williamson
This really is _not_ the way to do it. Since he's using iOS4 he can use the new `UIGestureRecognizer` which were made for this purpose. Ohmu's answer is better suited.
Yannick Compernol
Ah. That's helpful. Thanks.
Matt Williamson
+2  A: 

There is a new API for this: Refer to this post here.

Ohmu