Xcode 9 - “Fixed Width Constraints May Cause Clipping” and Other Localization Warnings

后端 未结 13 1178
失恋的感觉
失恋的感觉 2020-11-27 10:33

I downloaded the new Xcode and in Interface Builder I\'m having a ton of problems with warnings that say things like:

Fixed Width Constraints May Caus

13条回答
  •  生来不讨喜
    2020-11-27 11:26

    You can try Disabling "Respect Language Direction" on per Constraint basis to silence the warning and see if it helps. Select your constraint and open Attributes/Size Inspector. Please see image attached.

    If you are not planning on localizing your app to other languages, then this solution should not have any fallbacks. For localized apps you have to be more conscious of your label and font sizes.

    p.s. This solution works for iOS. For macOS try >= or <= to silence the warning.

    p.p.s. Labels in the picture below are much easier to create using AutoLayout and attributedString property on a single UILabel or UITextView using NSMutableAttributedString. The image is for demonstration purposes only.

提交回复
热议问题