admin管理员组

文章数量:1122832

I'm working with a CADisplayLink in iOS to synchronize my rendering with the screen refresh rate. On devices running iOS 15 or later, CADisplayLink allows us to specify a preferredFrameRateRange using CAFrameRateRange(minimum:maximum:preferred:).

I'm trying to understand how to choose the best values for minimum, maximum, and preferred based on different use cases. Here's the setup I'm working with:

let displayLink = CADisplayLink(target: self, selector: #selector(render))
if #available(iOS 15.0, *) {
    displayLink.preferredFrameRateRange = CAFrameRateRange(minimum: 30, maximum: 120, preferred: 60)
} else {
    displayLink.preferredFramesPerSecond = 60
}
displayLink.add(to: .current, forMode: .default)

How should I decide on the values for minimum, maximum, and preferred?

  • For example, what values are suitable for apps that need smooth animations or high performance?

  • Is there any guidance on how these values affect ProMotion displays (like the iPhone 15 Pro Max) that dynamically adjust refresh rates?

  • Are there any specific trade-offs or best practices to consider for adaptive frame rates or energy efficiency?

本文标签: