I'm having trouble running UISplitViewController in a generic application, where I already encoded part of the iPhone. As a troubleshooting method, I decided to start with a new project and just try to perform one action that causes the problem, and it still exists.
If I create a universal application, and in the iPad controller I create a split view (either in XIB or in the code), then it looks black (if you do not set the background color). If I only do this in the iPad application, it displays just fine.
I would appreciate it if someone could check it out on their own and see if they get the same, or tell me where I am going wrong.
- In Xcode, create a universal βwindowβ application.
- Log in to your iPad controller and paste the code below.
What I get is a black screen, not a split view. The same code works in iPad-only. What am I doing wrong, or what is 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; }
iphone uikit uisplitviewcontroller
codepoet
source share