简体   繁体   中英

Specifying entry point for storyboard (not the initial view)

My project has many tabs. Each tab is implemented using xib files. 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];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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