tags:

views:

136

answers:

2

When I drag a finger across the screen, there seems to be a limit to how quickly touchesMoved gets called. It seems that the limit is around 50/second. What controls this limit, and is it possible to change this?

I'm guessing this is controlled at a very low level and I'm stuck with it, but perhaps not. I'd love to be able to have a higher resolution time-wise for these touch events.

+1  A: 

It takes computational resources to handle touchesMoved, especially if you do a lot in your touch handler, so you are going to hit an upper bound at some point, assuming it is not capped.

My guess is that there is no cap, and you are just hitting the upper bound of what the iPhone can handle while it is also trying to draw your application.

Just a guess though.

Jeff B
I've stripped out everything in my touch handler and am now just writing time stamps to an array, which I print out later. This has no effect on the rate at which the touches come in. It looks to me like there is a cap, or it's dependant on some loop that checks for changes around 50x per second.
morgancodes
Quite possible there is a cap, i.e. it samples 60/s or so.
Jeff B
BTW, what is the application of sampling faster? I would imagine if you are moving fast enough for this to matter, accuracy is not going to matter a whole lot. I can think of some cases to the contrary, just curious what your case it.
Jeff B
In this case, I made a little toy that places a very short sound every time a touchesMoved event was recieved. I wanted to make a musical instrument based on this idea -- like running a fingernail over the teeth of a comb. But it's not really possible if I can't get more precise touchesMoved data.
morgancodes
A: 

Yes, I think the iPhone is sampling the touches roughly 60 times per second. When you spend time in touchedMoved that number decreases relative to how much time you are using for processing the touch.

St3fan
Thanks St3fan. Are you just guessing (like me) about this sampling rate, or do you think there's some documentation somewhere that mentions it?
morgancodes
It is a guess, but based on research and what I saw when writing a game. Shameless plug: http://www.tickletapapps.com/soundshaker
St3fan