下面是我的代码,我无法加载第一个视图控制器,建议我不使用嵌入式导航控制器。
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let storyBoard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
let firstViewController = storyBoard.instantiateViewControllerWithIdentifier("LoginViewController")
self.window?.rootViewController = firstViewController
return true
}
答案 0 :(得分:1)
答案 1 :(得分:1)
1)确保填写故事板的正确名称。 2)检查视图控制器的标识符名称。
然后,
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController = storyboard.instantiateViewControllerWithIdentifier("LoginViewController") as UIViewController
self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
return true
}
答案 2 :(得分:0)
let storyBoard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
在这里更改您的故事板名称。
答案 3 :(得分:0)