我能够解决故事板问题。我有一个带有主细节情节提要设置的通用应用程序,因此我将它们全部保留,并将应用程序的初始化更改为不使用情节提要,而是以编程方式在我的 applicationDidFinishLaunching 中进行设置,如下所示:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
self.masterController = [storyboard instantiateViewControllerWithIdentifier:@"masterController"];
self.detailController = [storyboard instantiateViewControllerWithIdentifier:@"detailController"];
self.splitViewController = [[MGSplitViewController alloc] init];
self.splitViewController.masterViewController = self.masterController;
self.splitViewController.detailViewController = self.detailController;
ACALandingVC* landingVC = [self.detailController.childViewControllers objectAtIndex:0];
landingVC.splitController = self.splitViewController;
self.splitViewController.delegate = landingVC;
//self.splitViewController.splitWidth = 5;
self.splitViewController.allowsDraggingDivider = YES;
self.splitViewController.dividerStyle = MGSplitViewDividerStylePaneSplitter;
self.splitViewController.splitPosition = 350;
self.splitViewController.splitWidth = 10;
self.window.rootViewController = self.splitViewController;
}
else {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
UITabBarController* firstVC = [storyboard instantiateInitialViewController];
self.window.rootViewController = firstVC;
[[UINavigationBar appearance] setTintColor:[UIColor lightGrayColor]];
}
[self.window makeKeyAndVisible];
我的 AppDelegate.h 看起来像:
@class MGSplitViewController;
@interface ACAAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, strong) MGSplitViewController* splitViewController;
@property (nonatomic, strong) UITabBarController* masterController;
@property (nonatomic, strong) UINavigationController* detailController;
@end