I want to show an animation in my view .so I used CADisplaylink
as a timer so that it will call the update method 60 times in a second (60FPS).
But when the tableview which in the same superview reload ,the CADisplaylink
called only 40-50times a second (40-50FPS).
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(update)];
self.displayLink.paused = YES;
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
How can I fixed it?
From the CADisplayLink class reference:
The target can read the display link’s timestamp property to retrieve the time that the previous frame was displayed. For example, an application that displays movies might use the timestamp to calculate which video frame will be displayed next. An application that performs its own animations might use the timestamp to determine where and how displayed objects appear in the upcoming frame. The duration property provides the amount of time between frames. You can use this value in your application to calculate the frame rate of the display, the approximate time that the next frame will be displayed, and to adjust the drawing behavior so that the next frame is prepared in time to be displayed.
Meaning the frame rate is determined by the system, and you should base your animation off that. There is no way to set the frame rate, rather it will be determined by a combination of factors (e.g. how processor intensive active actives are, how graphic intensive the UI is, etc.).