小编典典

转到另一个故事板?

javascript

是否可以从一个情节提要到另一个情节提要,或者将情节提要嵌入到另一个情节提要的视图控制器中?我需要将 aUITabBarController放在 a 中UINavigationController,并且我想让它们保持良好和分开。


阅读 127

收藏
2022-07-06

共1个答案

小编典典

是的,但您必须以编程方式进行:

// Get the storyboard named secondStoryBoard from the main bundle:
UIStoryboard *secondStoryBoard = [UIStoryboard storyboardWithName:@"secondStoryBoard" bundle:nil];

// Load the initial view controller from the storyboard.
// Set this by selecting 'Is Initial View Controller' on the appropriate view controller in the storyboard.
UIViewController *theInitialViewController = [secondStoryBoard instantiateInitialViewController];
//
// **OR**  
//
// Load the view controller with the identifier string myTabBar
// Change UIViewController to the appropriate class
UIViewController *theTabBar = (UIViewController *)[secondStoryBoard instantiateViewControllerWithIdentifier:@"myTabBar"];

// Then push the new view controller in the usual way:
[self.navigationController pushViewController:theTabBar animated:YES];
2022-07-06