[英]iOS - How do I set another view controller to be my initial view controller when my app starts?
有时会在Xcode中发生。 我已完成以下工作以解决问题:
将此代码添加到AppDelegate didFinishLaunchWithOptions
。 将您的视图控制器情节提要板标识符设置为“ MyViewController”或您想要的任何名称。
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let yourVC = mainStoryboard.instantiateViewControllerWithIdentifier("MyViewController") as! MyViewController
appDelegate.window?.rootViewController = yourVC
appDelegate.window?.makeKeyAndVisible()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.