Search code examples
iosobjective-cuikituilabelnsattributedstring

Does an NSAttributedString in a UILabel ignore the label’s numberOfLines property?


I need to increase the line spacing in a UILabel, so I’m using its attributedString to do so. Works fine, but it ignores the fact that I had also set the label’s numberOfLines to 2 – it only displays a single line, and truncates.

Any idea why this might be, what I can do about it, to still use two lines, but increase the spacing between them?


Solution

  • It sounds like the frame of your UILabel isn't big enough. Try increasing the height and see if the problem persists.