In xcode 6.1, interface builder deleting ui elemen

2019-02-16 12:41发布

I have a view with some tableviews and some collection views and also some buttons and labels.

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. 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. 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.

I'm wondering if this is a bug in Xcode or if I have done something to cause this behavior which I can change.

Thanks!

9条回答
叛逆
2楼-- · 2019-02-16 13:07

I found that it's fixed on the next version of xcode (6.1.1)

查看更多
做自己的国王
3楼-- · 2019-02-16 13:08

I think I ran into this 'problem'. I believe this was because one of the constraints I had was not setup correctly.

查看更多
对你真心纯属浪费
4楼-- · 2019-02-16 13:08

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. Then I resize this subview to 320 x 568. My program works. 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 !

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 ! 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 !

查看更多
Summer. ? 凉城
5楼-- · 2019-02-16 13:14

I have reset the size class wCompact hAny to which all the UIElements are added. and got corrected.

查看更多
我命由我不由天
6楼-- · 2019-02-16 13:22

From here it looks like a bug in Xcode 6.1.

I created a clean project and the behaviour is the same on my machine:

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.

I've raised a bug with Apple. Suggest you do the same.

workaround: You can install xcode 6.01 and use interface builder from there. You can still compile and run your code using xcode 6.1 if you're relying on xcode 6.1 specific features. (you'll need to rename your xcode.app so you can run both instances. ) It's ugly, but it works.

查看更多
Fickle 薄情
7楼-- · 2019-02-16 13:23

I had the same problem in universal app; iphone works fine and the ipad doesnt work.

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

Fix:

So i fixed it by setting Simulated Metrics in interface builder by Size = iPad Full Screen and Orientation by Landscape or Portrait

查看更多
登录 后发表回答