简体   繁体   English

Xcode 11 Beta - Storyboard ViewControllers 出现黑色

[英]Xcode 11 Beta - Storyboard ViewControllers Appears Black

I have updated by Xcode to Xcode 11 Beta and have updated the build settings from iOS 12.2 to iOS 13. Everything is working perfectly but the viewcontrollers in Storyboard appear black.我已通过 Xcode 更新到 Xcode 11 Beta,并将构建设置从 iOS 12.2 更新到 iOS 13。一切正常,但 Storyboard 中的视图控制器显示为黑色。 The components of the viewcontrollers are present but it is difficult to preview due to the black screens视图控制器的组件存在,但由于黑屏而难以预览在此处输入图像描述

Had this same issue, eventually tracked it down by cut-pasting elements from the black screen to a brand new view controller and see which ones cause the new one to have the same error, or caused the old one to render.遇到了同样的问题,最终通过将黑屏中的元素剪切粘贴到全新的视图控制器来追踪它,看看哪些导致新的出现相同的错误,或者导致旧的渲染。

After fixing it, the diff ended up being a background image on a specific UIButton.修复后,差异最终成为特定 UIButton 上的背景图像。

I found that after updating to Xcode 11 if one element has an issue, it breaks the whole storyboard like your screenshot.我发现在更新到 Xcode 11 后,如果一个元素出现问题,它会像您的屏幕截图一样破坏整个情节提要。

I had this issue last night.我昨晚有这个问题。 My UITableView was expanding too far out of the screen on the right hand side.我的 UITableView 在右侧的屏幕之外扩展得太远了。 I dragged it back into the bounds of the UIViewController parent and updated the right hand side constraint to be 0.我将它拖回 UIViewController 父级的边界,并将右侧约束更新为 0。

So check if anything goes beyond the UIViewController boundary that shouldn't.所以检查是否有任何东西超出了不应该的 UIViewController 边界。

In Xcode 12.4在 Xcode 12.4 中

After trying lots of thing, finally i resolved my issue在尝试了很多事情之后,我终于解决了我的问题

First close your project.首先关闭您的项目。

just goto finder -> Application -> Xcode -> get info -> uncheck open using Rosetta只需转到查找器 -> 应用程序 -> Xcode -> 获取信息 -> 取消选中使用 Rosetta 打开

Now, simply open your project.现在,只需打开您的项目。

只需删除该视图控制器中的任何约束,然后撤消更改。

I had the same issue, here are the steps I followed.我有同样的问题,这是我遵循的步骤。

  1. Clear constraints, for my case the source was from UITableView, and make sure constraints are attached to safearea not superview.清除约束,就我而言,源来自 UITableView,并确保约束附加到安全区域而不是超级视图。

看图

  1. From the toolbar on the top, go to Editor > Canvas > Layout Rectangle.从顶部的工具栏中,转到编辑器 > 画布 > 布局矩形。 It is very important to repeat this step 3 times.重复此步骤 3 次非常重要。

Once finished, quit XCode and reopen it again and everything should be fixed.完成后,退出 XCode 并重新打开它,一切都应该得到修复。 I've noticed this happens when I'm switching views for different devices 8, 11, 4s.我注意到当我为不同的设备 8、11、4s 切换视图时会发生这种情况。

Check the values for the cell heights.检查单元格高度的值。 In opening an older project, the row height (in the TableView itself) was 0. Changing it to a positive value or deleting the value (so it defaults to automatic) fixed the issue for me.在打开一个较旧的项目时,行高(在 TableView 本身中)为 0。将其更改为正值或删除该值(因此默认为自动)为我解决了这个问题。

I don't know exactly what the problem was, but I was able to solve it with the following steps.我不知道究竟是什么问题,但我能够通过以下步骤解决它。

  1. Run 'pod install' to install all cocoapods dependencies运行 'pod install' 以安装所有 cocoapods 依赖项
  2. In Xcode: Product -> Clean Build Folder在 Xcode 中:产品 -> 清理构建文件夹
  3. Restart Xcode and run the project重启 Xcode 并运行项目

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

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