Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I have an existing iPhone app that I want to make universal. However, I would like some pretty big changes to the iPad version. I would like the iPad version to use a Split View Controller as the root, and in the Master View, have my Tab Bar Controller which will display all TableViews. In the iPad's MainWindow.xib I have a split view controller with a Tab Bar instead of the navigation controller as a child. What all needs to be done in the AppDelegate to have the split view as the root controller on iPad, but leave the iPhone version unchanged?

Here is what I have tried so far. Here is my AppDelegate.h
Code:
@interface TylerBrassfieldAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
    UIWindow *window;
    UITabBarController *tabBarController;
	UIBackgroundTaskIdentifier *backgroundTask;
	XLappMgr *appMgr;
    IBOutlet UISplitViewController *splitView;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@property (nonatomic, retain) IBOutlet UISplitViewController *splitView;
@end
and AppDelegate .m didFinishLaunching
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    sleep(3);
   

    // Override point for customization after application launch.
	
	// Set the tab bar controller as the window's root view controller and display.
    if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
    {
        self.window.rootViewController = self.splitView;
        [self.window makeKeyAndVisible];

    }
    else {
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    }
	
	
    return YES;
}
I then get in the MainWindow-iPad.xib and drop in a Split View Controller. I copy the Tab Bar Controller for the child under the split view controller, and connect the UIApplicationDelegate of SplitView to the SplitViewController. When I run as iPhone, it still stays the same, but when I run as iPad, all I get is a black screen. Any suggestions?
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.