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
and AppDelegate .m didFinishLaunching
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?
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
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;
}
Last edited: