Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between CADisplayLink's displayLinkWithTarget:selector: and UIScreen's displayLinkWithTarget:selector:?

CADisplayLink having this method makes sense, but I'm curious why UIScreen would also have it.

like image 812
meisel Avatar asked Oct 17 '22 19:10

meisel


1 Answers

Documentation says that the display link provided by the screen is tied to that screen. However, looking at the official documentation, there is no apparent relation to any screens; the display link is added to a runloop and that's it.

Digging deeper in the private headers, there is a display property, of type CADisplay, which is also found for UIScreen. So it seems, that indeed, you can create display links specific to screens. Normally on iOS and tvOS, there is only one screen, but that is not always the case (such as connecting a monitor to an iOS device). If your app supports external monitors, and you find the need to use a display link, you should use the -[UIScreen displayLinkWithTarget:selector:] method.

Consider opening a bug report with Apple with a documentation enhancement request to clarify the above behavior.

like image 91
Léo Natan Avatar answered Oct 21 '22 01:10

Léo Natan