Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8181463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:31:57+00:00 2026-06-07T00:31:57+00:00

In a UISplitViewController setup on iPad, RootViewController is a UIViewController class with a XIB

  • 0

In a UISplitViewController setup on iPad, RootViewController is a UIViewController class with a XIB file (not a UITableViewController.)

My App has several targets. Depending on the target selected (and via #ifdef ... in the code), I’d like to specify a different XIB file for RootViewController.

I guess the changes have to be made in application:didFinishLaunchingWithOptions

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Add the split view controller's view to the window and display.
    self.window.rootViewController = self.splitViewController;
    [self.window makeKeyAndVisible];

    return YES;
}

== EDIT ==

I deleted all controllers from MainWindow.xib, then added the following lines in the AppDelegate. RootViewController is launched with the appropriate XIB, but the mechanics between RootVC and DetailsVC in SplitViewController does not work; ie. when hitting a button in RootVC that should trigger a change in DefaultVC, nothing happens. I am obviously missing something.

splitViewController = [[UISplitViewController alloc] init];

#ifdef OPTION1
    rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController_1" bundle:nil];
#elif OPTION2
    rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController_2" bundle:nil];
#endif

defaultViewController = [[[DefaultViewController alloc] init] autorelease]; 

UINavigationController *rootNav = [[[UINavigationController alloc] initWithRootViewController:rootViewController] autorelease];
UINavigationController *defaultNav = [[[UINavigationController alloc] initWithRootViewController:defaultViewController] autorelease];

splitViewController.viewControllers = [NSArray arrayWithObjects:rootNav, defaultNav, nil];
splitViewController.delegate = defaultViewController;

self.window.rootViewController = self.splitViewController;
[self.window makeKeyAndVisible];

// Add the split view controller's view to the window and display.
self.window.rootViewController = self.splitViewController;
[self.window makeKeyAndVisible];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:31:58+00:00Added an answer on June 7, 2026 at 12:31 am

    You code example seems like a really hard and confusing way to do a split view controller, so I’ll just address the more general question:

    My App has several targets. Depending on the target selected (and via #ifdef … in the code), I’d like to specify a different XIB file for RootViewController.

    If you have multiple targets defined in your project, you don’t need #ifdefs to do this. It’s much simpler to use the target mechanism of the build process.

    Lets say you have two resources, both called “MyFunResource”, but one you’d like to use in a target called “blue”, the other you’d like to use in one called “red”.

    Add both resources to your project. But in the file inspector (View > Utilities > Show File Inspector) note the section called “Target Membership”. Note that all your targets are listed there with checkboxes next to them. When building a given target, a selected resource will only be copied into the bundle when it has that target’s name checked here.

    So select the “MyFunResource” that you want to be used in the “red” target, and makes sure “red” is the only thing with a checkmark next to it in “Target Memberships”. Then select the one you want for “blue” and make sure only “blue” is checked.

    Now when you build the red target, the build system will only copy the red-related resource into the bundle, so magically, the red resource is what will get used at runtime. And vice-versa with the blue. No code or ‘#ifdef’s required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this button on the leftside of my UISplitViewController (RootViewController) that has a
I'm using UISplitViewController for app on iPad. The first task was to show master
In ipad app I want to set UISplitViewController method set in portrait mode.(i.e Like
I am building a universal app that uses a UISplitViewController for the iPad, and
I've created an iPad application with a UITableViewController in the UISplitViewController (and everything works
I have an app for iPad with a UISplitViewController in it (UsersSplitViewController). On the
I am doing an iPad app based on a UISplitViewController. I have a little
I'm trying to put together an iPad app using UISplitViewController and storyboards. The master
I'm currently using UISplitViewController as my app's rootViewController. To present progress dialogs I use
I have a UISplitViewController in a xib file that contains two custom UIViewControllers. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.