views:

438

answers:

1

In the iPad Programming Guide, it gives the following code example for specifying the two views (firstVC and secondVC) that will be used in the SplitView...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   MyFirstViewController* firstVC = [[[MyFirstViewController alloc]
                     initWithNibName:@"FirstNib" bundle:nil] autorelease];
   MySecondViewController* secondVC = [[[MySecondViewController alloc]
                     initWithNibName:@"SecondNib" bundle:nil] autorelease];

   UISplitViewController* splitVC = [[UISplitViewController alloc] init];
   splitVC.viewControllers = [NSArray arrayWithObjects:firstVC, secondVC, nil];

   [window addSubview:splitVC.view];
   [window makeKeyAndVisible];

   return YES;
}

but when I actually create a new SplitView project in Xcode, I don't see any code that says the default rootView and detailView views should be added to the SplitView. Where can I find that?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after app launch    
    rootViewController.managedObjectContext = self.managedObjectContext;


    // Add the split view controller's view to the window and display.
    [window addSubview:splitViewController.view];
    [window makeKeyAndVisible];

    return YES;
}

I'm new to iPhone OS programming and I'm just trying to understand how this all works. Thanks in advance for all your help! I'm going to continue researching this question right now.

+1  A: 

It's because the links are set up in the *.nib file already. You could still use the .viewControllers approach if you don't want to rely on the *.nib to do it automatically.

KennyTM
excellent, thank you!
BeachRunnerJoe