简体   繁体   English

XCode AutoLayout保存问题

[英]XCode AutoLayout Saving Problems

I'm having a nagging issue with AutoLayout. 我在使用AutoLayout时遇到了一个棘手的问题。 So... 所以...

  1. I fired up Xcode and what do you know I have 50+ new layout warnings all in Regular Width and Regular Height mode (for iPads). 我解雇了Xcode,你知道我在常规宽度和常规高度模式(适用于iPad)中有50多个新的布局警告。
  2. I make corrections that get rid of the warnings and save. 我做出更正,摆脱警告并保存。
  3. I quit and re-open Xcode and the warnings are all back as if I never did a thing... 我退出并重新打开Xcode,警告都回来了,好像我从来没有做过什么......

What. 什么。 The. 的。 Expletive. 脏话。

Has anyone else had this issue OS is 10.9.5 and Xcode is 6.1.1. 有没有其他人有这个问题OS是10.9.5而Xcode是6.1.1。

Anyone have any ideas? 有人有想法么?


I had the same problem with the version of xcode Version 7.1 (7B91b) 我对xcode版本7.1(7B91b)的版本有同样的问题
Unfortunately I was unable to find a permanent solution (I think it's a bug in xcode) But I managed to find a small solution that allows you to continue working without fix every time the warnings. 不幸的是我无法找到一个永久的解决方案(我认为这是xcode中的一个错误)但我设法找到一个小的解决方案,让你可以在每次警告时继续工作而无需修复。 You must change the type of layout from the original (wCompact hRegular) and immediately return back to the original layout. 您必须从原始布局更改布局类型(wCompact hRegular)并立即返回到原始布局。 Magically disappear all warnings. 神奇地消失所有警告。

The orange lines are indicators that you have not set enough constraints. 橙色线是您没有设置足够约束的指示器。 I've worked with Autolayout a lot and in my experience, it's pretty reliable when it gives you orange lines. 我和Autolayout合作很多,根据我的经验,当它给你橙色线条时它非常可靠。 If there is no ambiguity, the lines should be blue. 如果没有歧义,则线条应为蓝色。

I have faced the same problem. 我遇到了同样的问题。 However, this is a mere experience but I thing it is trying to turn the size classes to the default size class and creating this issue. 但是,这仅仅是一种体验,但我认为它试图将大小类转换为默认大小类并创建此问题。

If you have created an universal project, your default size classs should be wAny hAny. 如果您已创建通用项目,则默认大小类应为wAny hAny。 In such case, if you change the size class to wRegular hRegular and set the layouts even properly, you will get warnings as soon as you reopen the xCode project, as it will give you these warnings. 在这种情况下,如果将size类更改为wRegular hRegular并正确设置布局,则只要重新打开xCode项目就会收到警告,因为它会为您提供这些警告。 That is why, when you run the app, everything is fine because it got the layout properly, but the warnings may reappear as it is trying to adjust the layouts for the default size classes which is wAny hAny. 这就是为什么,当你运行应用程序时,一切都很好,因为它正确地得到了布局,但警告可能会再次出现,因为它正在尝试调整默认大小类的布局,即wAny hAny。

My suggestion would be to change the size classes to its default and then fix the warnings. 我的建议是将大小类更改为默认值,然后修复警告。 That is also a standard practise. 这也是一种标准做法。

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

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