我想从appDelegate设置初始视图控制器.我找到了一个非常好的答案,然而它是在目标C中,而我在快速实现同样的事情上遇到了困难.
Programmatically set the initial view controller using Storyboards个
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *viewController = // determine the initial view controller here and instantiate it with [storyboard instantiateViewControllerWithIdentifier:<storyboard id>];
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
}
有人能帮上忙吗?
我希望初始ViewController依赖于使用条件语句满足的某些条件.