问题
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
回答1:
Give each of your ViewControllers a separate ID, and then instantiate the required one with:
UIViewController *initialVC = [storyboard instantiateViewControllerWithIdentifier:@"<identifier>"];
回答2:
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...
来源:https://stackoverflow.com/questions/8872215/multiple-entry-points-to-a-storyboard