简体   繁体   中英

Multiple entry points to a storyboard

I need to make a set of decisions in the AppDelegate on launch - depending on the outcome of those decisions I need to go to specific parts of the storyboard.

So my question is - WITHOUT using any nav or tab controllers, how do I go to a specific part of a storyboard?

OR

Is the only supported option having multiple storyboards - for each of the 'outcomes' and then loading those as required?

Thanks

Give each ViewController a unique identifier in the storyboard. Then in the appDelegate:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"PUT_UNIQUE_ID_HERE"];
    //DO WHAT YOU WANT WITH YOUR VIEWCONTROLLER
   //Example:Set it as the root view of the app window...

为每个ViewControllers分配一个单独的ID,然后使用以下命令实例化所需的ID:

UIViewController *initialVC = [storyboard instantiateViewControllerWithIdentifier:@"<identifier>"];

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