简体   繁体   中英

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

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 ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM