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
2
votes
3 answers
How to set CADisplayLink in Swift with weak reference between target and CADisplayLink instance
In Objective-C, we can init CADisplayLink with Proxy Pattern to break strong reference:
WeakProxy *weakProxy = [WeakProxy weakProxyForObject:self];
self.displayLink = [CADisplayLink displayLinkWithTarget:weakProxy…

a_tuo
- 651
- 7
- 23
2
votes
1 answer
CADisplayLink catches animation with delay
Trying to reproduce behaviour described in this article. Line by line. Everything works well but the last step...
The problem is: I unpause CADisplayLink just before calling UIView.animate and expect the unpaused CADisplayLink to call the attached…

iWheelBuy
- 5,470
- 2
- 37
- 71
2
votes
0 answers
Correct way to create CADisplayLink: UIScreen vs. init()
There are 2 ways to get CADisplayLink in iOS. The direct one is to use initializer:
let displaylink = CADisplayLink(target: self,
selector: #selector(step))
Returns a new display link.
This way is used in Apple's…

kelin
- 11,323
- 6
- 67
- 104
2
votes
1 answer
UIImageView Rotation Animation using CADisplayLink - Tracking Rotation
I've been advised to try CADisplayLink to rotate a UIIMageView. I'm building this app using Storyboard.
I need to start and stop the animation, when the screen is tapped. I also need to track the angle at which the rotation stopped when the screen…

Reanimation
- 3,151
- 10
- 50
- 88
2
votes
2 answers
CADisplaylink code fires even when display doesn't refresh
Note: as of iOS7 this problem may only manifest in the simulator -- still testing.
I have an implementation of CADisplayLink, and I need the code to run if and only if the display actually refreshes
This doesn't happen.
Here's a very simple test…

iambsoft
- 21
- 2
2
votes
2 answers
CADisplayLink on iPhone 3GS and iPhone 4 drops from 60 to 40 FPS randomly
I am using CADisplayLink to perform a function called gameLoop at 60 FPS and at first the application runs perfectly. Then at a random time (could be 5 seconds or 1 minute the fps drops to around 40 FPS.
After days of searching forums, debugging,…

user1591589
- 31
- 3
2
votes
1 answer
CADisplayLink Timestamp acts strange on device
For my game loop and certain animations I want to know the time interval that has passed since the last call of my render: method.
For this I use the CADisplayLink and grab the current timestamp and subtract the timestamp of the last call. This…

Mauin
- 483
- 3
- 12
1
vote
1 answer
Communicating Data Between Model And View In IOS Programming
I am constructing an iPhone side-scroll video game from the ground up. I have an Enemy model that needs to change the position of an enemy's arms and legs. I need to communicate those changes to the view for display. Should I use an NSTimer inside…

Brett George
- 141
- 2
- 7
1
vote
1 answer
CADisplayLink fires one additional time after stopping it
Everything was OK, until yesterday when my app started to behave weirdly. It works OK on simulator but on iPhone4 it performs one additional cycle even after stopping it. Here's my initializer that creates a new CADisplayLink timer or resumes…

Centurion
- 14,106
- 31
- 105
- 197
1
vote
0 answers
iPhone app runs differently when launched from Xcode
I am working on a game that essentially has two timers to control gameplay. One timer is a CADisplayLink that makes a call to redraw the display (with OpenGL) every frame, so slightly under 60 Hz. The other timer is an NSTimer that updates game…

pinerd314159
- 534
- 4
- 10
1
vote
2 answers
Proper way to run CADisplayLink on async background thread?
What is the proper way to make CADisplayLink callback functions run on a background thread? I'm creating the Display Link with:
let displayLink = CADisplayLink(target: self, selector: #selector(self.renderBackground))
if let displayLink =…

Jeshua Lacock
- 5,730
- 1
- 28
- 58
1
vote
1 answer
CADisplayLink Timer Not working proper | Swift
I've been stuck with my timer, my goal is to know for how long the user sees the post to count it as impression. what I mean is if you watch an event for more than 3 seconds it will count as Impression.
Now for some reason the timer works not as I…

Aviav Sabag
- 81
- 1
- 8
1
vote
1 answer
Using @EnvironmentObject properties with CADisplayLink
I'm trying to implement CADisplayLink for some animations, but when I try to access my MainData environment object properties from inside class MyAnimations, I get the fatal error No ObservableObject of type MainData found. A…

West1
- 1,430
- 16
- 27
1
vote
0 answers
Threads, priority and quality of service on IOS
Our game uses a CADisplayLink and OpenGLEs2.0 to try to render at 60fps. We have a few threads running too, to handle server calls, background loading, etc. I'm trying to optimise the background file loading and on a test if the priority is set to…

user3162134
- 287
- 1
- 10
1
vote
1 answer
CADisplayLink is unable to achieve a constant frame rate in simulator
I am trying to use CADisplayLink to achieve a constant frame rate for a game loop. When testing it in a simulator I am not able achieve stable time frames. Should I consider a different approach?
Or is that just because of the simulator not being…

Nusatad
- 3,231
- 3
- 11
- 17