IOS Delay between touchstart and touchmove?

I am trying to convert my web app to a mobile usable form. I am trying to build support for touch gestures such as horizontal scrolling. I am finding strange behavior in my application.

I start a gesture with a touchstart event and then scroll the touch button. However, my application sees a delay of 500-700ms between receiving these two events. As far as I can tell, my application is not doing any other work in between these two events.

Other aspects: The code is written in jquery using

  $(element).bind(touchmove, function(ev) {return myobject.DoTouch(ev) } 

      

the DoTouch command just checks the ev.type, records the touch position and returns false.

Any ideas what I should be looking for to try and resolve this? The delay between touching and receiving a response from the app is very annoying.

+3


source to share


1 answer


Yes. It turns out this is how iOS works. I pulled my hair out for a while. More details here: http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html . Basically, if iOS thinks it can handle it as an internal PAN gesture, it does and doesn't even bother dispatching an event touchmove

at all.

In my project, I found that if the viewer makes a touchmove gesture very deliberately and pauses a little longer before lifting their finger at the end of the move, then the event touchmove

is essentially dispatched as expected. Thus, the documented behavior may be slightly different from reality, which only added to the confusion and my debugging efforts.



In any case, if iOS handles the event internally as a PAN gesture, it will dispatch the event scroll

before touchend

. In my project, I was able to use this to set a flag that I used to distinguish between drag and drop gestures (which was usually sent in my touchmove handler) and ignore any behavior in standalone touchhend handlers that were not related to handling my own scroll processing.

I hope this helps you (and others) too!

0


source







All Articles