我想从appDelegate调用故事板场景[storyboard ID : MyScene]
,
我已经搜索并尝试了很多关于堆栈溢出的答案!但找不到有效的解决方案。
我试过的一个代码,
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
UIViewController *sc= (UIViewController *)[mainStoryboard instantiateViewControllerWithIdentifier:@"MyScene"];
[self.window.rootViewController presentViewController:sc animated:YES completion:nil];
答案 0 :(得分:1)
尝试使用此代码调用一些延迟。
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
// Your code for presenting
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
UIViewController *sc= (UIViewController *)[mainStoryboard instantiateViewControllerWithIdentifier:@"MyScene"];
[self.window.rootViewController presentViewController:sc animated:YES completion:nil];
});