How to run a Timer in connection the the display refresh rate?

327 views Asked by At

I have an object who calculate the velocity of a scrolling area. When the user move up his finger off the screen, then this object fire an event every 10 ms to update the position of the scrolling (regarding to the calculated velocity) and refresh the screen (by calling setNeedsDisplayInRect of a GLKView object).

I m just worry to synchronize my event with the actual display refresh rate (that is 60 fps normally). Under ios is their any way to fire an event on each display refresh (so around every 16 ms) ? maybe i must use cadisplayLink for this ?

1

There are 1 answers

1
Duncan C On BEST ANSWER

Yes, it sounds like CADisplayLink Is your best bet. It is designed to sync with screen refresh.