views:

413

answers:

2

Problably you know that iPhone OS makes an artifical delay of about 0.25 seconds after an touchesBegan: occures. This is to check if the user intends to move or not. If the deltas move significantly enough during this time, a touchesMoved: sequence starts.

But when you want to implement tactile touch behaviour in your app, you may not want any delay. It looks so ugly! You start moving something, and for 0.3 seconds nothing happens. Then, BANG and the whole thing starts to move with a big flip. That happens every time a new touch sequence with movement begins. This seriously sucks. Of course in some situations it is needed because you may want to determine if the user really intended to move. but not so on a custom-build slider or other kind of tactile control that works by tracking touch movements.

So after I figured out that this is happening intentionally by iPhone OS, I'd like to know how to overcome this problem. I can't predict movement because the user might move to left, or to right. I don't know this in touchesBegan:. 0.3 seconds is just enough to make the app look unresponsive.

However, there seems to be hope: Convertbot has absolutely no issue with that. The wheel rotates immediately upon touching and moving it. There is no lag, no delay. I askded in their blog how they did it, but no response yet.

I hope there is a way to pull manually touch coordinates out from the system. When touchesBegan:, I'd start a interval that pulls at 60hz until touchesMoved: takes action.

So the biggest question on this planet: "How is that possible"?

+1  A: 

If your responders are in a UIScrollView, make sure you set the scrollView's delaysContentTouches setting to NO. This will work for both UIResponder's touchesBegan: method and UIControl's beginTrackingWithTouch: method.

Mike Laurence
A: 

If your UIView subclass is a subview of a UITableView or one of its descendants, such as UITableView, you have to delaysContentTouches to NO on the scroll view or table view. That way it'll immediately send the first touch to your touchesBegain:.

However, I think that ConvertBot doesn't use UIScrollView at all: it's probably a custom UIView that implements the rotating part itself. If your UI doesn't require scrolling, then just put your UIView subclass in the content view, and you don't have to set delaysContentTouches because there's no scroll view to intercept touch events.

lucius