Search code examples
iosoverlayuiwindowkeywindow

Creating new UIWindows, taking over key window -- bad practice?


I'm working on an app which needs to display an overlay an top of everything else. It does this by creating a new UIWindow, and using makeKeyAndVisble to "take over" the screen. When it's done, it gives control back back to the original UIWindow.

Is this a bad thing to do? It feels like it's taking control of the app at a low level, which is generally bad; on the other hand, it's very straightforward to do, so maybe it's perfectly acceptable.

Opinions/experiences?


Solution

  • In my experience it is perfectly fine to add another UIWindow on top of the default one.

    I also do not think that this is like taking control of the app at a low level. If I consider that the iOS SDK is closely related to the MacOS SDK, I tend to think that multiple window are perfectly supported at a higher level of abstraction: it is only that on iOS they are not so necessary or useful (generally speaking, apart from specific cases).

    Digging a bit on the web, I found this interesting discussion on S.O.

    Hope it helps.