0

Say, if we already have aScreen that points to the main screen, by

UIScreen *aScreen = [UIScreen mainScreen];

can we get to the main UIWindow object from this UIScreen object? (do they have any connection at all? That is, instead of using [UIApplication sharedApplication].keyWindow)

nonopolarity
  • 146,324
  • 131
  • 460
  • 740

2 Answers2

1

No.

The application has a list of windows, usually just one. Each window has a screen property that indicates where it's currently located. The screen object holds information about the physical device.

It seems inspired on OSX NSScreen, there is no a list of windows per screen. Each app has windows, each window knows in which screen is located.

djromero
  • 19,551
  • 4
  • 71
  • 68
1

A UIWindow knows which screen it's assigned to, but a UIScreen doesn't know what UIWindows are using it. That's why the standard pattern is to save the main window as a property of the ApplicationDelegate, so you'll have a reference to it.

strings42
  • 543
  • 3
  • 9