How to set Main Inerface in xCode programatically
Posted
by
Tom Tallak Solbu
on Stack Overflow
See other posts from Stack Overflow
or by Tom Tallak Solbu
Published on 2012-10-22T16:58:59Z
Indexed on
2012/10/22
17:00 UTC
Read the original article
Hit count: 170
xcode
I am using Apples MultipleDetailViews http://developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html for template as a source for my iPad app. The template is using a splitviewController in the interface builder (MainWindow). In the iPhone/iPad Deployment info of the target, MainWindow is set as the "Main Interface".
I want my app to also run on iPhone. This means I need to load a different xib when the app is run on an iPhone. I must then remove "MainWindow" from "Main Interface" because the app will crash when I load on an iPhone due to the splitViewController.
The AppDeleagte of the template look like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = self.splitViewController;
[self.window makeKeyAndVisible];
}
If I remove "Main Window" from "Main Interface", how do I then need to change the APpDelegate, or maybe I need to change the MainWindow.xib to also work for iPhone?
© Stack Overflow or respective owner