tags:

views:

718

answers:

1

Hello All,

The documentation of UITouch mentions that you can get the [B]direction[/B] of finger swiped. But I am unable to find any way/reference how to get the direction information.

I found an old version of UITouch class reference that mentions direction information. "http://nuigroup.com/?ACT=28&fid=42&aid=696_Nh3eV276ETEwxTj8C42f"

But this way does not work for me(I have latest iPhone SDK). Has anyone of you tried finding direction? Kindly share your findings.

Thanx, Jinbaba

A: 

Apple says you can get it, but in the Event Handling documentation they also explicitly say you have to calculate it. It's not too hard to do though, and there is a sample provided therein. I did it simply by caching the initial touch point, and on touch end ensuring that the touch moved at least 80px in one direction and not more than 75% of the length in the other direction. This gave me good results, but feel free to experiment on what you feel gives the least false positives and negatives.

David Kanarek