Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I change the window my app uses from UIWindow to my own subclass "MyWindow" with storyboard?

I've got a universal project here with storyboard. I've created a subclass of UIWindow called MyWindow, and I need to load it instead of the default UIWindow. Prior to storyboard, I would simply go to the .XIB file in XCode and change the class for the main window to MyWindow. However, I'm unable to find any section where I can change this in storyboard.

Does anyone know where I can do this? I need the main window to load MyWindow, not UIWindow.

like image 531
thebro Avatar asked Oct 25 '11 01:10

thebro


1 Answers

When using storyboards the application delegate and main window are no longer represented in Interface Builder. Instead, when your app starts, your app delegate is queried for a property called 'window'. If this returns nil then a default window of type UIWindow is created for you. To change this behaviour you need to implement a 'window' getter method in your app delegate that returns your 'MyWindow' subclass. See the documentation.

like image 161
Robin Summerhill Avatar answered Nov 07 '22 02:11

Robin Summerhill