views:

218

answers:

1

I'm developing an game which has a component based on UISliders. The player must slide them from left to right one at a time, and on occasion two at a time. The problem lies in the double slides. When sliding two UISliders at a time, the sliders lag behind the player's touches, and often create noticeable lag in the game (this was tested on iPhone 3GS). I'm assuming this is due to the OS trying to recognize a multitouch gesture, but I'm not certain.

My question is what can I do to alleviate the lag? It must be possible because there are drawing apps out there that use up to 5 fingers without much lag, so 2 should be cake.

A: 

Let me guess, are you redrawing the screen in the event handler for the UISlider? In which case you are trying to do it redundantly a lot of the time. Instead of redrawing in the event handler, record the change in your view controller. Then you have a timer set up and in that you check to see if your variable is set and if so redraw then.

U62
I'm not sure exactly what you mean. Could you elaborate a please? I'm not doing any custom drawing; I've only changed the thumb image and a few properties in my UISlider subclass.
Arman
I'm still looking for an answer to this.
Arman
Are your UISliders inside a UITableViewCell by any chance? I'm trying to figure out the root of the same issue I'm having. The way it seems to work is... the iPhone SDK waits for the user to "hold" their finger on the UISlider for like ~300ms, and I can't figure out why or how to override this. The only way I can sort of do it is by subclassing the containing UITableView and checking the hitTest event on it, but when I return control back to the UISlider on a successful hitTest, the issue persists. :( I wish I had better news for you but I am in the same boat I think.
taber