Question

Can some one confirm me that only one UIWindow instance is possible in any iPhone Application at any time?

UPDATE: I found the following information in this link . According to this there can be many windows.

In addition, the UIApplication object maintains a list of all the windows (UIWindow objects) currently open in the application, so through those it can retrieve any of the application’s UIView objects.

OTHER TIPS

I had successfully used multiple UIWindows in the past. There is a number of reasons to that. For example you wouldn't be able to release rootViewController of a UIWindow no matter how many times you would set it to nil. But collecting the window does the trick. There are some visual effects and clean code separation that can be achieved by using multiple windows. I am pleasantly surprised how many people are unwilling to experiment. Apple only says "should not". If they wouldn't want us to use it, we wouldn't be able too or even know about.

There's three types of window, and IMHO it makes sense to use all of them.

  1. Normal windows - the keyWindow that you use in every app

  2. Statusbar windows - used for customization e.g. "what happens when a user clicks on the statusbar" (default is to scroll a scrollview to top of page, but you can add other behaviours - e.g. if your app doesn't use scrollviews, but it makes sense to provide an "equivalent" functionality)

  3. Alert windows - e.g. if you're going to make custom popups. Many developers make custom popups, but don't declare them as alert windows. Sometimes this causes graphical glitches, e.g. if an asynch thing happens, and appears over the top of your popup, or if an animation animates over the top of it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top