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,开发者_如何学C 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.
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.
精彩评论