简体   繁体   English

在xcode 6.1中,界面构建器删除了ui元素

[英]In xcode 6.1, interface builder deleting ui elements

I have a view with some tableviews and some collection views and also some buttons and labels. 我有一些视图,包括一些tableviews和一些集合视图,还有一些按钮和标签。

I'm not sure if this is new with Xcode 6.1 because I have not worked on the ui aspect of this project for some time. 我不确定这是否是Xcode 6.1的新功能,因为我已经有一段时间没有研究过这个项目的ui方面了。 However, when I try to resize just about anything in the view, my tableviews and collection views, and possibly some other elements I am not noticing, get deleted. 但是,当我尝试调整视图中的任何内容时,我的tableviews和集合视图以及可能的其他一些我没有注意到的元素会被删除。 Specifically, it seems their frame or rect propertied get deleted. 具体来说,似乎他们的框架或矩形属性被删除。

To be clear, this only occurs when I attempt to resize the element by dragging the sides in interface builder. 要清楚,这只有在我尝试通过在界面构建器中拖动边来调整元素大小时才会出现。 If I resize them by changing the numbers directly either in the IB sidebar or in the xml, this does not happen. 如果我通过直接在IB侧栏或xml中更改数字来调整它们的大小,则不会发生这种情况。

I'm wondering if this is a bug in Xcode or if I have done something to cause this behavior which I can change. 我想知道这是否是Xcode中的错误,或者我是否已经做了一些导致我可以改变的行为。

Thanks! 谢谢!

I acheived a fix, at least for this project by turning off auto layout in "show the file inspector" -> "interface builder document" 我通过在“显示文件检查器” - >“界面构建器文档”中关闭自动布局来实现修复,至少对于此项目

I have never used this feature in the past so I do not know if it was on in the past but I am wondering if the new Xcode version turns it on by default where the others left it off. 我以前从未使用过这个功能,所以我不知道它是否在过去,但我想知道新的Xcode版本是否默认打开,而其他人则将其关闭。 It may also be possible that it has always been on but there is a bug in the feature in the new version. 它也可能一直处于开启状态,但新版本中的功能存在错误。

This fixed the issue for me, at least in this particular project and at least for now. 这为我解决了这个问题,至少在这个特定的项目中,至少目前如此。 I hope others find this useful. 我希望其他人觉得这很有用。

From here it looks like a bug in Xcode 6.1. 从这里看起来像Xcode 6.1中的一个错误。

I created a clean project and the behaviour is the same on my machine: 我创建了一个干净的项目,我的机器上的行为是一样的:

https://github.com/nasht/Xcode6ConstraintTest.git https://github.com/nasht/Xcode6ConstraintTest.git

Resizing one view makes others disappear. 调整一个视图的大小会使其他视图消失。 Changing a layout constraint from a = to <= or >= also seems to do it. 将布局约束从a更改为<=或> =似乎也是如此。

I've raised a bug with Apple. 我向Apple提出了一个错误。 Suggest you do the same. 建议你这样做。

workaround: You can install xcode 6.01 and use interface builder from there. 解决方法:您可以安装xcode 6.01并从那里使用界面构建器。 You can still compile and run your code using xcode 6.1 if you're relying on xcode 6.1 specific features. 如果您依赖于xcode 6.1特定功能,您仍然可以使用xcode 6.1编译和运行代码。 (you'll need to rename your xcode.app so you can run both instances. ) It's ugly, but it works. (你需要重命名你的xcode.app,这样你就可以运行这两个实例。)这很难看,但它确实有效。

我发现它已经修复了xcode的下一个版本(6.1.1)

same problem, yosemit and xocde 6.1. 同样的问题,yosemit和xocde 6.1。 I can resize some view only if i disable autolayout. 只有在禁用自动布局时才可以调整某些视图的大小。

I think I ran into this 'problem'. 我想我遇到了这个'问题'。 I believe this was because one of the constraints I had was not setup correctly. 我相信这是因为我遇到的一个限制是没有正确设置。

What OS X Version are you on? 你有什么OS X版本? I updated to Yosemite today and 6.1 along with it. 我今天更新了Yosemite和6.1。 When I would resize a label my other elements were not getting deleted but instead getting resized and repositioned. 当我调整标签大小时,我的其他元素没有被删除,而是重新调整大小并重新定位。 The width / height would change to 0,0 and the x / y would change to 0,0 as well. 宽度/高度将更改为0,0并且x / y也将更改为0,0。

I was noticing other issues with Yosemite so went ahead and did a time capsule restore back to Mavericks and Xcode 6.0 我注意到Yosemite的其他问题,所以继续前进并将时间封装恢复到Mavericks和Xcode 6.0

I had the same problem in universal app; 我在通用应用程序中遇到了同样的问题; iphone works fine and the ipad doesnt work. iPhone工作正常,ipad无法正常工作。

I'm using xCode 6.1 and OSX Yosemite My app supports iOS7 and iOS8 and i had the same problem on iOS7 on iPad version only 我正在使用xCode 6.1和OSX Yosemite我的应用程序支持iOS7和iOS8,我在iOS7上仅在iPad版本上遇到同样的问题

Fix: 固定:

So i fixed it by setting Simulated Metrics in interface builder by Size = iPad Full Screen and Orientation by Landscape or Portrait 所以我通过在界面构建器中通过Size = iPad Full ScreenLandscape by Landscape或Portrait设置Simulated Metrics来修复它

I have got the same kind of problem with Xcode 6.1 and Yosemite : I have created a view that I have added to the main view, so it appears like a sub view in the View Controller Scene. 我遇到了与Xcode 6.1和Yosemite相同的问题:我创建了一个我已添加到主视图的视图,因此它看起来像是View Controller Scene中的子视图。 Then I resize this subview to 320 x 568. My program works. 然后我将此子视图调整为320 x 568.我的程序有效。 It corresponds to the program dropit of Stanford CS193P Lecture 9. I save the project, close it and reopen it : the subview has its width and height set to 0 ! 它对应于斯坦福CS193P讲座9的程序dropit。我保存项目,关闭它并重新打开它:子视图的宽度和高度设置为0!

I tried to open the project dropit of Lecture 8 that is quite the same, which was working before (I think in Xcode 6) and same problem ! 我试图打开第8讲的项目dropit,这是完全相同的,之前正在工作(我认为在Xcode 6中)和同样的问题! First I thought that tapping (related to the subview) was not working but found out that tapping was not working because I was tapping on a subview which has its width and height set to 0 ! 首先我认为点击(与子视图相关)不起作用,但发现点击不起作用,因为我正在点击其宽度和高度设置为0的子视图!

I have reset the size class wCompact hAny to which all the UIElements are added. 我已经重置了添加了所有UIElements的大小类wCompact hAny。 and got corrected. 并得到纠正。

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

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