openfrog
openfrog

Reputation: 40735

Is there something better than an NSTimer, when time is absolutely crucial?

I remember there were some kind of fancy, super-special CALayer types or classes for cases where timing is absolutely crucial to the app. I want to flash a CALayer in a certain frequency which triggers an light sensor and transmits data over light. Similar to IR remote controls. It's an experiment. I need to let it flash between 5 and 50 times per second, with different durations between 0.02 and 0.2 seconds.

An NSTimer just scedules something on the run loop, but I guess that it doesn't guarantee anything. I even remember it can happen that some callbacks just drop out, so it's not really good for crucial high-precision timing, isn't it?

Can anyone remember what kind of sync/timing CALayer stuff this is that could help? Or is OpenGLES my best friend here?

Upvotes: 3

Views: 202

Answers (1)

RolandasR
RolandasR

Reputation: 3047

CADisplayLink - it will give you screen refresh resolution.

Upvotes: 2

Related Questions