简体   繁体   English

指定故事板的入口点(不是初始视图)

[英]Specifying entry point for storyboard (not the initial view)

My project has many tabs.我的项目有很多标签。 Each tab is implemented using xib files.每个选项卡都是使用 xib 文件实现的。 For one particular view controller I want to use storyboard.对于一个特定的视图控制器,我想使用故事板。 I am relatively new to the storyboards and wanted to know how to specify the entry point for the storyboard.我对故事板比较陌生,想知道如何指定故事板的入口点。

My current code looks like this.我当前的代码看起来像这样。

- (UIViewController *)viewControllerForTabDocs {
    DocsViewController *vc = [[DocsViewController alloc] init];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
    return nav;
}

You should try the followings您应该尝试以下方法

UIStoryboard *storybrd = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
DocsViewController *controller =[storybrd instantiateViewControllerWithIdentifier:@"docsViewController"];
UINavigationController* nav = [[UINavigationController alloc]initWithRootViewController:controller];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM