Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0

前端 未结 10 1675
太阳男子
太阳男子 2020-11-28 00:21

I opened an existing iOS project with Xcode6 beta6, and Xcode lists the following warning for both Storyboard and Xib files:

Automatic Preferred Max L

相关标签:
10条回答
  • 2020-11-28 01:02

    Solution it's quite simple

    Just enable Builds for iOS 8 and Later

    enter image description here

    0 讨论(0)
  • 2020-11-28 01:02

    I got it working by selecting the original layout I had in the W / H selection. Storyboard is working as expected and the error is gone.

    Be also sure that you are developing for iOS 8.0. Check that from the project's general settings.

    This is where you should press.

    0 讨论(0)
  • 2020-11-28 01:05

    For some reason, even if changing the iOS Deployment Target to 8.0 or higher, the Xib files don't adopt that change and remain with the previous settings in the File inspector

    Therefore, you should change it manually for each Xib

    Once done, the warning will disappear :-)

    0 讨论(0)
  • 2020-11-28 01:07

    I had this issue and was able to fix it by adding constraints to determine the max with for a label.

    When dropping a multiline label in there is not constraint set to enforce the width inside the parent view. This is where the new PreferredMaxWidth comes into play. On iOS 7 and earlier you have to define the max width yourself. I simply added a 10px constraint to the left and right hand side of the label.

    You can also add a <= width constraint which also fixes the issue.

    So this is not actually a bug, you simply have to define the max width yourself. The explicit option mention in other answer will also work as you are setting this width value however you will have to modify this value if you want the max width to change based on the parent width (as you have explicitly set the width).

    My above solution ensures the width is always maintained no matter how big the parent view is.

    0 讨论(0)
提交回复
热议问题