UILabel truncate tail and skip not complete word

前端 未结 3 1275
后悔当初
后悔当初 2021-01-05 09:40

I have a single line UILabel. It has width = screen width and the content now is (the content of UILabel can change)

You hav

3条回答
  •  醉话见心
    2021-01-05 10:15

    Ideally this is not possible,with default UILabel, when you set lineBreakMode to TruncatingTail, depending on the space required by the letter/word the OS will truncate it, one solution to fix the issue you can use following properties depending on your match.

    Minimum Font Scale -- Use this property to specify the smallest multiplier for the current font size that yields an acceptable font size to use when displaying the label’s text. If you specify a value of 0 for this property, the current font size is used as the smallest font size.

    Minimum Font Size -- When drawing text that might not fit within the bounding rectangle of the label, you can use this property to prevent the receiver from reducing the font size to the point where it is no longer legible.

提交回复
热议问题