G33kz0r G33kz0r - 8 months ago 714
iOS Question

How to remove a UIWindow?

I thought it was easy as

[myWindow resignKeyWindow]
[self.window makeKeyAndVisible]
but I guess not… Would you guys know what to do?

Thanks :)


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.