我创建了新的ios项目,我所做的就是转到main.storybord并将其嵌入到导航控制器中,得到了黑屏,我不能将任何东西拖到视图控制器上。

class ViewController: UIViewController {
override func viewDidLoad() {
    super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}
}

最佳答案

不管你做了什么,我都知道了,你必须按照他在回答中所说的做,但如果是你的情况,你可以拖拽Navigationcontroller并把它给segue。因此在这种情况下UIviewController不会获得根viewController并显示黑屏。
@iYoung
用户界面输出:
ios - 导航 Controller 显示黑屏-LMLPHP
Navigationcontroller中使用此代码

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

self.window = UIWindow(frame: UIScreen.main.bounds)

let storyboard = UIStoryboard(name: "Main", bundle: nil)

self.window?.rootViewController = storyboard.instantiateViewController(withIdentifier: "ViewController")

self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()

   return true
}

关于ios - 导航 Controller 显示黑屏,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41407841/

10-11 01:15