ストーリーボードを使用していて、特定のXIBのセットをロードしたいのですが、問題は次のエラーが発生することです。
'NSInvalidArgumentException', reason: 'Application tried to present a Split View Controllers modally <PlaceHolderViewController: 0x38e890>
このPlaceHolderViewController
コードでxibをロードするボタンがありますが、iPhoneからxibをロードするのに問題はありませんが、iPadではこの問題が発生しています。
これはコードです:
- (IBAction)actionButtonConversor:(id)sender {
ConverterViewController *converterViewController;
UnitSelectViewController *unitSelectViewController;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
converterViewController = [[ConverterViewController alloc] initWithNibName:@"ConverterViewController_iPhone" bundle:nil];
unitSelectViewController= [[UnitSelectViewController alloc] initWithNibName:@"UnitSelectViewController_iPhone" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:converterViewController];
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.0f green:0.48235297203063965f blue:0.63137257099151611f alpha:1];
[self presentModalViewController:self.navigationController animated:YES];
} else {
converterViewController = [[ConverterViewController alloc] initWithNibName:@"ConverterViewController_iPad" bundle:nil];
unitSelectViewController= [[UnitSelectViewController alloc] initWithNibName:@"UnitSelectViewController_iPad" bundle:nil];
UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:unitSelectViewController];
UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:converterViewController];
masterNavigationController.navigationBar.tintColor = [UIColor colorWithRed:0.0f green:0.48235297203063965f blue:0.63137257099151611f alpha:1];
detailNavigationController.navigationBar.tintColor = [UIColor colorWithRed:0.0f green:0.48235297203063965f blue:0.63137257099151611f alpha:1];
self.splitViewController = [[UISplitViewController alloc] init];
self.splitViewController.delegate = converterViewController;
self.splitViewController.viewControllers = [NSArray arrayWithObjects:masterNavigationController, detailNavigationController, nil];
[self presentModalViewController:self.splitViewController animated:YES]; // ERROR comes from here i think
}
unitSelectViewController.delegate = converterViewController;
converterViewController.unitSelectViewController = unitSelectViewController;
}