Xcode 6 beta 6 - 主故事板上的项目已消失/禁用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25988541/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:39:45  来源:igfitidea点击:

Xcode 6 beta 6 - Items on main story board have disappeared/disabled

iosxcodeswiftxcode6-beta6

提问by user2099024

I've encountered this problem on Xcode 6 Beta 6. When I select the main storyboard view where I can see all the views of my app with all the components (buttons, lists etc.) I can only see the view itself but no components in them event though I have put them there before. When I build and run the app in the simulator all the components are visible, but when I develop I cannot see them. On the left side of the user interface view of main storyboard all the controllers are listed, and when I expand each of them I can see the components that should be displayed on the view but they are like disabled (faded out).

我在Xcode 6 Beta 6上遇到过这个问题。当我选择主情节提要视图时,我可以在其中看到我的应用程序的所有视图以及所有组件(按钮、列表等)。我只能看到视图本身,但在事件中没有组件,尽管我之前已经将它们放在那里。当我在模拟器中构建和运行应用程序时,所有组件都是可见的,但是当我开发时我看不到它们。在主故事板的用户界面视图的左侧,列出了所有控制器,当我展开每个控制器时,我可以看到应该在视图上显示的组件,但它们就像禁用(淡出)一样。

The compiler does not show any errors or warnings. Does anyone have a clue of what's going on and how I can fix this?

编译器不会显示任何错误或警告。有没有人知道发生了什么以及我如何解决这个问题?

EDIT:I have now installed the latest version but I still have the same problem. Has no-one ever had this problem?

编辑:我现在已经安装了最新版本,但我仍然遇到同样的问题。没有人遇到过这个问题吗?

回答by Peter

I had the same problem. The problem is that the invisible/greyed out views are not "installed" for the currently selected size class. You can see what size class(es) a view is installed for by selecting that view and then going to the Attributes Inspector in the right pane and scrolling all the way to the bottom. There should be one or more checkboxes that say Installed.

我有同样的问题。问题是对于当前选择的尺寸等级没有“安装”不可见/变灰的视图。通过选择该视图,然后转到右侧窗格中的 Attributes Inspector 并一直滚动到底部,您可以查看该视图安装的尺寸等级。应该有一个或多个复选框显示已安装。

This will tell you which size classes a view is installed in. Clicking on the checkboxes will install/uninstall that view for the given size class. To get the views to appear on the storyboard, you need to select the size class that they are installed in by clicking on the control in the center of the bottom bar in the storyboard (it will show you the currently selected w and h size classes).

这将告诉您视图安装在哪些尺寸等级。单击复选框将为给定尺寸等级安装/卸载该视图。要让视图出现在情节提要上,您需要通过单击情节提要底部栏中央的控件来选择它们所安装的大小级别(它将显示当前选择的 w 和 h 大小级别)。

I'm not sure what I did to cause my views to be uninstalled for the currently-selected size classes, but making sure that all the checkboxes here were checked brought my views back.

我不确定我做了什么导致我的视​​图为当前选择的大小类被卸载,但确保这里的所有复选框都被选中使我的视图返回。

If you find Size Classes to be too much trouble, you can go to the File Inspector pane and disable size classes entirely by unchecking the Use Size Classes checkbox.

如果您发现 Size Classes 太麻烦,您可以转到 File Inspector 窗格并通过取消选中 Use Size Classes 复选框来完全禁用 size classes。

回答by user2099024

Ok now it's fixed. For everyone who has encoutered the same problem here is what I did. First of all I installed the newest version of xcode but the problem was still there. Then I opened the main storyboard and I saw that some of my views had the wrong size (not the iphone size as I had chosen when I made the views - it was the size of an ipad or something like that). So what I did was just to select the views that had the wrong size and resize them to iphone-size again by clicking on the "Any Any" button on the bottom of xcode after selecting a view.

好的,现在已经修复了。对于在这里遇到同样问题的每个人,这就是我所做的。首先,我安装了最新版本的 xcode,但问题仍然存在。然后我打开主故事板,我看到我的一些视图的尺寸有误(不是我在制作视图时选择的 iphone 尺寸 - 它是 ipad 或类似尺寸的尺寸)。所以我所做的只是选择大小错误的视图,然后在选择视图后单击 xcode 底部的“Any Any”按钮再次将它们调整为 iphone 大小。