简体   繁体   中英

XCode AutoLayout Saving Problems

I'm having a nagging issue with 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).
  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...

What. The. Expletive.

Has anyone else had this issue OS is 10.9.5 and Xcode is 6.1.1.

Anyone have any ideas?


I had the same problem with the version of xcode Version 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. You must change the type of layout from the original (wCompact hRegular) and immediately return back to the original layout. 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. 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. 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. 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.

My suggestion would be to change the size classes to its default and then fix the warnings. That is also a standard practise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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