Replacing storyboard with XIB
interface-builder, ios, xcode, xcode4.3
Solution
Don't put anything into the Main Interface field. Instead, load your top-level controllers in the app delegate's didFinishLaunchingWithOptions: method and set the window's root controller there.
Application start-up assumes that a xib mentioned there has a File's Owner that is a UIApplication. (Older templates used to do that and some sample projects still do.)
Problem
How can I replace storyboard with XIB? While trying to create dynamically views and their controllers, I lost all advantages of the new storyboard. Now, when trying to remove it from the project, I created a new XIB with its own controller and replaced it in project settings: Now, when trying to run the application, it crashes and the log shows me the following: ``` 2012-04-08 14:50:16.567 Bazaart[11340:15203] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x8c15c20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.' ``` Here is the code of: UIRootWindow: ``` #import <UIKit/UIKit.h> @interface UIRootWindow : UIViewController @end ``` And its corresponding implementation: ``` #import "UIRootWindow.h" @implementation UIRootWindow - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; return self; } - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewDidUnload { [super viewDidUnload]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } @end ``` EDIT: I've the window as suggested by Phillip (see below). But... the way I did it is not the best, it seems. Am I doing it right? ``` UIRootWindow *wnd = [[UIRootWindow alloc] init]; [wnd view]; [self setWindow:wnd.window]; ```