如何访问storyboard以及appDelegate中的UIViewControllers。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
return YES;
}
答案 0 :(得分:1)
试试这个:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *uvc = [storyboard instantiateViewControllerWithIdentifier:@"Details"];
[self.window.rootViewController presentViewController:uvc animated:YES completion:nil];
答案 1 :(得分:0)
对于你的UIViewController名为MyViewController并且其storyboard名称为MyViewController.storyboard的情况,你请求的代码如下所示:
// load storybord with name MyViewController.storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MyViewController" bundle:nil];
// get an instance of root view controller for the storyboard
MyViewController *viewController = [storyboard instantiateInitialViewController];