GSHeartbeat

From iPhone Development Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


GSHeartbeat is a group of C functions that allows you to register a callback function when the display is updated. It has the same purpose as CADisplayLink, but they have nothing in common otherwise.

GSHeartbeat is mainly used for updating the scroller.

Example code

static int counter;

static void heartbeatCallback(void* pCounter, GSHeartbeatTime time) {
  printf("%lg: counter = %d\n", time, *(int*)pCounter);
  ++ *(int*)pCounter;
}

...
GSHeartbeatRef heartbeat = GSHeartbeatCreate(heartbeatCallback, kCFRunLoopDefaultMode, NO, &counter);
...

Header