A CADisplayLink object is a timer object that allows your application to synchronize its drawing to the refresh rate of the display.
Questions tagged [cadisplaylink]
137 questions
3
votes
2 answers
Slow down CADisplayLink interval
I was using NSTimer for my iOS application but I wasn't getting the result I wanted because of SetNeedsDisplay.
I made some research and found the CADisplayLink which is giving me the result I want about the animation. Sadly I can't manage to put a…

Bryan ORTIZ
- 306
- 3
- 17
3
votes
2 answers
How can I track screen renderer
How can I move object as function of time in React-Native?
In native iOS I do it like this:
CADisplayLink *link = [CADisplayLink displayLinkWithTarget:self selector:@selector(tick:)];
[link addToRunLoop:[NSRunLoop mainRunLoop]…

gran33
- 12,421
- 9
- 48
- 76
3
votes
0 answers
Synchronizing CADisplayLink changes to an in progress CAAnimation
I'm trying to combine CADisplayLink and CAAnimation so that I can animate some layers with CAAnimation, and adjust others in realtime based on the changing presentation layer of the animated layers. I realize that CAAnimations are being driven…

gcs
- 103
- 8
3
votes
1 answer
How to set desired render frequency (FPS) in an iOS application?
I'm using CADisplayLink on an iOS app with a renderOneFrame method/handler. My understanding is this is triggered every screen refresh, i.e. 60Hz.
However my app is struggling to run at 60FPS and with more features to add, I worry that on older…

Mr. Boy
- 60,845
- 93
- 320
- 589
3
votes
1 answer
Frame rate compromised with CADisplayLink and drawRect
My question is about iOS development. I am writing a simple game in order to test the low level Core Graphics functions (contexts, layers, etc) and how to mix it with actual simple views... I explain it:
I have a simple sprite in the screen, it is…

Ayoze Roberto Bernardo
- 276
- 1
- 2
- 9
3
votes
2 answers
CADisplayLink at iOS 6.0 not retaining target
I have a such code:
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:@selector(updateFrame)]];
[invocation setTarget:self];
[invocation setSelector:@selector(updateFrame)];
displayLink_ =…

Siarhei Fedartsou
- 1,843
- 6
- 30
- 44
2
votes
1 answer
crash with AVCapture based viewController
I m working on an app which use OpenGL VideoCapture inside a UIViewController
on the first init of this controller I get this message in the console:
wait_fences: failed to receive reply: 10004003
the message is displayed right after viewController…

Nico AD
- 1,657
- 4
- 31
- 51
2
votes
1 answer
CADisplayLink with NSRunLoopCommonModes not executed for every frame when tracking UIScrollView?
I am trying to execute a small piece of code on every single frame in a regular (non-OpenGL) iPhone app. The goal is to have a frame counter so that I can measure (rather than guess) where the slow points in the app are and fix them to create a…

Daniel Wagner
- 61
- 2
- 7
2
votes
0 answers
Can someone explain to me how scheduling works between a main thread and an NSThread?
For example is it doing something like SCHED_FIFO or SCHED_RR from pthreads? Can the scheduling policy be changed? Can priorities be assigned to the main thread and an NSThread?
Ultimately I would like the main thread to run at 30 Hz with a…

Xavier
- 8,828
- 13
- 64
- 98
2
votes
0 answers
CADisplayLink accuracy issues with OpenGL ES on iOS
My iOS game is currently using CADisplayLink for timing of OpenGL rendering operations. I've got a GCD dispatch queue running on a second thread that issues all the OpenGL rendering and state calls to the GPU. Everything works fine, except the…

Stu
- 1,282
- 12
- 29
2
votes
1 answer
CADisplayLink in RunLoop not calling callback
I have the following code which should make drawFrame be called every frame but it doesn't:
- (void)viewDidLoad
{
[super viewDidLoad];
displayLink = [viewReference.window.screen displayLinkWithTarget:(self) selector:@selector(drawFrame)];
…

Lars
- 163
- 4
- 12
2
votes
0 answers
iOS: The grey screen between Default.png and the first OpenGL ES frame
I'm trying to port my previous openGL iPhone app to use Xcode's new OpenGL ES template, which uses CADisplayLink.
WHat I've noticed is that after Default.png is displayed, and before the first frame is drawn, there is a grey screen in between that…

kamziro
- 7,882
- 9
- 55
- 78
2
votes
2 answers
How to animate a view in a circular motion using its real-time position coordinates?
I'm currently working on a SwiftUI project, and in order to detect intersections/collisions, I need real-time coordinates, which SwiftUI animations cannot offer. After doing some research, I came across a wonderful question by Kike regarding how to…

PGCodes
- 23
- 3
2
votes
1 answer
how to replace NSTimer with CADisplayLink?
I call a doPoof method using NSTimer as following:
[NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(doPoof:) userInfo:myCALayer repeats:FALSE];
How to replace the above using CADisplayLink instead of an NSTimer?

PrimeSeventyThree
- 940
- 2
- 9
- 24
2
votes
1 answer
Is CADisplayLink callback always runs on the main thread?
I couldn't find any direct answer online nor within the docs about this.
If I'm setting up CADisplayLink with the following:
let displayLink = CADisplayLink(target: self, selector: #selector(updateShimmer))
displayLink.add(to: .current, forMode:…

Roi Mulia
- 5,626
- 11
- 54
- 105