简体   繁体   English

迅速的NavigationController导致黑屏

[英]NavigationController in swift leads to a black screen

I'm trying to use a navigation controller for an identification process in my swift code but each time I click on a button that leads to it, it shows the following black screen: 我正在尝试将导航控制器用于我的快速代码中的识别过程,但是每次单击指向它的按钮时,它都会显示以下黑屏:

IOS模拟器上的黑屏

Here is my storyboard if this can helps, there is no warning and no error in the code (using a drag and drop segue or a programmatically one leads to the same black screen) 这是我的故事板,如果有帮助,代码中没有警告,也没有错误(使用拖放功能或以编程方式导致出现黑屏)

我的故事板与segues

Probably the segue you picked: mode & transition. 您选择的segue大概是:模式和过渡。

Are you certain you only have a single segue ? 您确定您只有一个segue吗? It is possible to have overlapping segues, which do not show up clearly in Interface Builder. 可能有重叠的序列,这些序列在Interface Builder中无法清楚显示。

Edit 编辑

Is there a way we can see all our segues? 有没有办法看到我们所有的故事?

  1. Open the Storyboard in its new window 在新窗口中打开情节提要
  2. Show Document Outline (leftmost pane) 显示文档大纲(最左侧的窗格)
  3. Show Attribute Inspector (rightmost pane) 显示属性检查器(最右边的窗格)
  4. Select each View Controller Scene in the Document Outline. 在文档大纲中选择每个View Controller场景。 The Segues are listed at the bottom. Segues列在底部。 You can inspect Identifier and Segue in the Attribute Inspector. 您可以在“属性”检查器中检查“ 标识符”和“ 序列 ”。

在此处输入图片说明

Sounds, I was doing the wrong way (drag a nav controller, delete the table view, add a new View controller and make the segue), but now if I create a view, and then I embed it in a navigation controller it sounds it works ! 听起来,我做错了方法(拖动导航控制器,删除表格视图,添加新的View控制器并进行设置),但是现在如果我创建了一个视图,然后将其嵌入导航控制器中,则听起来不错工程! Anyway, thanks a lot for your help, this definitely helps me ! 无论如何,非常感谢您的帮助,这绝对可以帮助我!

I got this when I assigned a custom view to self.view in viewDidLoad: . 当我在viewDidLoad:中将自定义视图分配给self.view时,得到了这个。

self.view = self.mapView

Adding mapView as a subview of self.view solved this. 添加mapView作为self.view的子视图解决了此问题。

[I see you've created a custom ViewController, are you sure it's a subclass of ViewController? [我看到您已经创建了一个自定义ViewController,您确定它是ViewController的子类吗?

You can see which subclass is it off after the ":" in the class declaration! 您可以在类声明中的“:”后看到关闭哪个子类! 图片

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用navigationController获得黑屏?.pushViewController(Swift 3.0) - Getting Black Screen with navigationController?.pushViewController (Swift 3.0) pushViewController导致黑屏 - pushViewController leads to a black screen 推送到NavigationController的iOS在黑屏中结束 - ios pushing to navigationController ends in black screen self.definesPresentationContext = true:导致黑屏吗? - self.definesPresentationContext = true: leads to black screen? self.navigationController pushViewController:动画:给我一个黑屏 - self.navigationController pushViewController: animated: gives me a black screen SpriteKit中带有Swift的presentScene上的黑屏 - black screen on presentScene in SpriteKit with Swift Swift-表格视图黑屏? - Swift - Table View Black Screen? 图像选择器/UIImagePickerController 显示空白屏幕/NavigationController swift 5 - image picker/UIImagePickerController show blank screen/NavigationController swift 5 从显示的屏幕显示导航控制器内的 ViewController:ios,swift - showing ViewController inside navigationController from a presented screen : ios, swift iOS-调用方法:[self.navigationController pushViewController:animated:],屏幕变黑 - iOS - call the method : [self.navigationController pushViewController: animated:], the screen get whole black
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM