I'm having trouble getting UISplitViewController working in a Universal app where I've already coded the iPhone portion. As a troubleshooting method, I decided to start with a new project and just try to do the one action that's causing a problem and it still is.
If I create a Universal app and in the iPad controller create a split view (either in a XIB or in code) then it appears as black (unless I set a background color). If I do it in an iPad-only app, it displays just fine.
I'd appreciate it if anyone could test this on their own and see if they get the same thing, or tell me where I'm going wrong.
- In Xcode, create a Universal "Window-based" app.
- Go into the iPad controller and paste in the code at the bottom.
What I get is a black screen, not a split view. The same code works in an iPad-only project. What am I doing wrong, or what is configured wrong?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UISplitViewController *split = [[UISplitViewController alloc] initWithNibName:nil bundle:nil];
UIViewController *vc1 = [[UIViewController alloc] initWithNibName:nil bundle:nil];
vc1.view.backgroundColor = [UIColor redColor];
UIViewController *vc2 = [[UIViewController alloc] initWithNibName:nil bundle:nil];
vc2.view.backgroundColor = [UIColor blueColor];
split.viewControllers = [NSArray arrayWithObjects:vc1, vc2, nil];
[window addSubview:split.view];
[window makeKeyAndVisible];
[vc1 release];
[vc2 release];
[split release];
return YES;
}