0

In my app I have an object(Car image) that needs to move on the screen. I need to schedule myFunction every 1ms if possible. I read apple documentation and I understood that NSTimer resolution is limited to 50-100ms, which is not enough for my use case (moving an object quickly on the screen).

What could be the alternatives to the NSTimer object?

Thanks in advance.

Abizern
  • 146,289
  • 39
  • 203
  • 257
simoscream
  • 135
  • 1
  • 9
  • 3
    You really need a frame rate of 1000 fps? Even if you could schedule a timer to do that, would you be able to update the objects on your screen that fast? – highlycaffeinated Aug 03 '11 at 23:49
  • @highlycaffeinated, to move an object allong the iphone screen (480px) (ie from position.x = 0 to Position.x = 480 by incrementing by 1px) with a fram rate 50ms (using a timer of time interval of 0.050s) I'll need 25s?! – simoscream Aug 05 '11 at 08:44

1 Answers1

1

I think you may be trying to show things at too fine a time rate. The screen doesn't refresh that fast, so having a timer fire with that frequency isn't going to help.

For timing graphics have a look at the CADisplayLink class which calls a selector when the screen needs to be refreshed. i.e. A timer that is based on the display refresh rate.

Abizern
  • 146,289
  • 39
  • 203
  • 257
  • I'm looking for the class used by apps for moving objects like car racing, I think that they are capable to move objects as quick as possible (move means refresh object position with smoth frames not jerking). If CADisplayLink is the one used I'll give it a try andlet you know. – simoscream Aug 05 '11 at 08:53