简体   繁体   English

在Interface Builder中添加约束时,Xcode会无限期挂起

[英]Xcode hangs indefinitely when adding constraints in Interface Builder

In summary, without height specified on a subview, adding constraint causes Xcode to hang. 总之,在子视图上未指定高度的情况下,添加约束会导致Xcode挂起。

I am using Xcode 6.3 (6D570) on Macbook Air with OSX 10.10.3, and am currently experiencing a very strange problem. 我在OS X 10.10.3的Macbook Air上使用Xcode 6.3(6D570) ,当前遇到一个非常奇怪的问题。 I have an .xib file, which contains a view and a scroll view. 我有一个.xib文件,其中包含一个视图和一个滚动视图。 Very simple, really. 很简单,真的。 Here's my current setup: 这是我当前的设置:

Xcode Interface Builder屏幕截图

Notice that the light blue/green section downwards are contained in a scroll view. 请注意,向下的浅蓝色/绿色部分包含在滚动视图中。 In the interface builder, the bright red section does not have constraints set yet. 在界面构建器中,亮红色部分尚未设置约束。 When I try to add, for example, a vertical space constraint to the lightgray view above it, Xcode hangs. 例如,当我尝试在其上方的浅灰色视图中添加垂直空间约束时,Xcode会挂起。

When Xcode hangs, the Size inspector tab becomes empty and the mouse starts spinning endlessly. Xcode挂起时,“大小”检查器选项卡变为空,并且鼠标开始不断旋转。 Here's the Size inspector screenshot when the hang happens: 这是挂起发生时的Size inspector屏幕截图:

挂xcode

After spending almost half a day, I managed to single out the problem. 花了将近半天的时间,我设法找出了问题所在。 This problem does not happen if I add the constraints via Pin button on the bottom right corner, and specifying the height constraint of the view. 如果我通过右下角的“ 固定”按钮添加约束指定视图的高度约束,则不会发生此问题。

固定萤幕撷取画面

Adding constraints only work as expected if I specify / add a height constraint first. 如果我先指定/添加高度约束,则添加约束只能按预期工作。 This also happens when I try to delete a constraint, for example, top space to container constraint from a label (that does not have a height constraint). 当我尝试删除约束时,例如从标签(没有高度约束)到容器约束的顶部空间,也会发生这种情况。 I can add them just fine, but when I try to remove a constraint or delete the view, Xcode hangs. 我可以很好地添加它们, 但是当我尝试删除约束或删除视图时,Xcode会挂起。

Oh, to add more confusion: this happens frequently . 哦,更令人困惑的是:这种情况经常发生 As in 7 hangs out of 10. 如在7中挂出10。

Things I have tried: 我尝试过的事情:

  • Remaking the view on different file 在不同文件上重建视图
  • Remaking the view on different project 重塑对不同项目的看法
  • Closing all applications except Xcode, including iOS Simulator 关闭除Xcode以外的所有应用程序,包括iOS Simulator
  • Restarting my computer 重新启动电脑

Things I have not tried: 没有尝试过的事情:

  • Reinstalling Xcode (or rolling back to previous version). 重新安装Xcode(或回滚到以前的版本)。

Should I just delete Xcode and install (download) fresh? 我应该删除Xcode并重新安装(下载)吗? Is this possibly a bug from the new Xcode? 这可能是新Xcode的错误吗?

It seems there's a bug within Xcode 6.3.0. 似乎Xcode 6.3.0中存在一个错误。 There's an update to 6.3.1 Apr 21, 2015 that should fix this issue: 2015年4月21日更新了6.3.1,可以解决此问题:

Xcode更新

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

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