简体   繁体   English

在界面构建器中发布故事板加载问题

[英]Issue loading storyboard in interface builder

I am building an app in Xcode 7.3.1 and it runs on devices and the simulator just fine, displaying the cells in my collection view.. but in interface builder the collection view cells do not appear.. 我正在Xcode 7.3.1中构建一个应用程序,它可以在设备上运行并且模拟器运行良好,可以在我的集合视图中显示单元格。但是在界面生成器中,集合视图单元格不会出现。

I can't state how to recreate this scenario as it seemed to bug out like this after some changes I made in code a while ago.. before that it was displaying in interface builder just fine! 我无法说明如何重新创建此方案,因为经过一段时间我在代码中进行了一些更改之后,它似乎像这样出错了..在此之前,它在界面构建器中显示得很好!

There should be two prototype collectionViewCells displaying on the view controller scene. 视图控制器场景上应显示两个原型collectionViewCells。

From my research it seems to be a documented visual bug but I have not yet found a solution to it. 从我的研究看来,这似乎是有记载的视觉错误,但我尚未找到解决方案。

No amount of 'cleaning/building' and closing and reopening the xcode project seems to fix this.. 似乎没有任何“清理/构建”以及关闭和重新打开xcode项目的方法可以解决此问题。

界面生成器未加载集合视图单元格

SOLVED!! 解决了!!

The answer, as described in this SO answer , is that the collectionview and its respective attributes did not have their appropriate size classes installed. 该SO答案所述,答案是collectionview及其相应的属性未安装其适当的大小类。

This is evident by the fact that the collectionview and labels in the screenshot below are greyed out. 通过以下屏幕截图中的collectionview和标签显示为灰色,可以明显看出这一点。

Xcode导航器

Using the advice from the SO link I solved my problem by selecting each greyed out component and then making sure that I ticked the top box labelled 'installed' in the attribute inspector. 使用来自SO链接的建议,我通过选择每个变灰的组件来解决我的问题,然后确保在属性检查器中勾选了标记为“已安装”的顶部框。

属性检查器

After doing this and remaking the constraints my storyboard was back to normal! 完成此操作并重新创建约束后,我的情节提要又恢复了正常!

界面构建器

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

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