Objective C - UILabel multiline vertical gap height

后端 未结 3 1407
遇见更好的自我
遇见更好的自我 2021-01-15 08:22

I have a multiline UILabel that can take a maximum of 3 lines. i.e message.numberOfLines = 3;

Everything works fine, but how can I set the vertical gap between the l

3条回答
  •  我在风中等你
    2021-01-15 08:49

    I haven't been able to find a way to adjust the spacing between lines. The font property of UILabel has a number of read-only properties, so that won't help.

    I've resorted to draw my own text if I want to change the line spacing. I use NSString's -drawAtPoint and -drawInRect and use one or more of the -sizeWithFont methods to figure out how long the text will be in order to split the text and draw the right number of words or characters per line.

提交回复
热议问题