I thought it was easy as [myWindow resignKeyWindow]
and [self.window makeKeyAndVisible]
but I guess not… Would you guys know what to do?
Thanks :)
The backdrop for your app's user interface and the object that dispatches events to your views. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.1+ tvOS 9.0+
The presentation of one or more views on a screen is coordinated by UIWindow object. In iOS application usually only has one window. while View multiple. Windows and Views both are used for present your application's content on the screen.
It's not an either/or kind of thing. Your app must have a UIWindow instance that is the container for the UIView instances you present. An app can either load the UIWindow instance from a nib file, or it can create it programmatically.
The correct way to hide a window is to set the hidden
property to YES. To remove it from UIApplication's windows
property you just release the window (in ARC you set all references to nil).
Of course you would want to have another window in place at this time.
Do not invoke -resignKeyWindow
directly, it was meant to be overridden to execute some code when your UIWindows gets removed. In order to remove old window you need to create new instance of UIWindow and make it -makeKeyAndVisible
, the old window will resign its key status. In iOS 4 it will even garbage collect your old UIWindow, provided you don't have any references to it. Doing this in iOS 3.x would have disastrous effects. Warned ya.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With