我想要从应用程序委托中设置初始的视图控制器。我找到了一个非常好的答案,然而它是在目标C中,而我在swift中实现同样的事情时遇到了困难。
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依赖于使用条件语句满足的某些条件。
https://stackoverflow.com/questions/26753925
复制相似问题