I have a tiny iOS app project set up.
I instantiate a CADisplayLink
and then log the time that passes between its calls to target-action. This is on an iPhone 15 Pro, so 120 hertz. However, I am observing that in user space, the actual tick rate of my target-action being called is actually fluctuating around 70-80 hertz.
But then, I instantiate a UIScrollView and give it a delegate. In the delegate I am observing that scrollViewDidScroll
gets called with the correct 120 hz. And if I set a breakpoint inside scrollViewDidScroll
, I can see that this is called from a CADisplayLink
handler inside UIScrollView
. How comes they can have 120hz, and I don't?
Of course, I did set UIScreen.maximumFramesPerSecond
to preferredFramerateRange
, minimum
, maximum
and preferred
.
Also, I don no virtually no work in the handler - I am just setting UIView.transform = CGAffineTransform(translationY: 100)
.
Also, my info.plist does indeed contain <key>CADisableMinimumFrameDurationOnPhone</key><true/>
Maybe do some profiling to determine how long your target function is taking to execute. If your function takes longer than the allocated time, then calls may be skipped.
Optimizing ProMotion refresh rates for iPhone 13 Pro and iPad Pro