简体   繁体   中英

navigation controller as root view controller only displaying black screen

这就是我的故事板的样子

My root view controller is a navigation controller, which leads to all my other view controllers. However, when running, it just displays a black screen and I am unable to go further in the app to all the other view controllers. The only code I have to load it is in the AppDelegate.

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UINavigationController?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    return true
    }
}

Probably you have mistaken to declare 'var window: UIWindow?' in your AppDelegate class.

Probably you forget to check the box is initial view controller. Go to the navigation storyBoard and try to check it.

you did not have to change anything in Appdelegate.

just remove navigationController from storyboard and than select your firstViewController than do this from the option on top of the mac:=

  1. Editor
    • Embed In
      • Navigation Controller

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM