Search code examples
iphoneuiimageviewquartz-graphicsnstimer

On iPhone, what is the best way to move a UIImageView with onscreen controls?


I am developing an iPhone version of this game. http://www.students.uni-mainz.de/rathb000/Fillit/Game.html

I am using an NSTimer to change the position of the ship by 1 pixel and the time interval for the timer is 0.002.

However, i have noticed that the ship doesnt move faster if i reduce the time interval furthur. Infact, there is no difference between 0.05 and 0.002. Is there is a restriction on the minimum time you have to give as NSTimeInterval?

The ship currently moves too slow for the game to be exciting.

Also, the movement of birds (which is also achieved by NSTimer) becomes slow when i press any button for moving the ship.

Any idea about how this can be solved?


Solution

  • Figured this out.

    Had to use Core Animation to move the ship and made the birds move by NSTimer. Works fine this way but only upto a certain limit. Birds again slow down when the speed of the ship increases more than a certain limit.