tags:

views:

30

answers:

1

How to increase a space between two lines in multiline label ??

+1  A: 

Short answer: you can't. To change the spacing between lines of text, you will have to subclass UILabel and roll your own drawTextInRect, or create multiple labels.

Long answer: In the print and online world, the space between lines of text is known as "leading." Leading is a read-only property of UIFont, which was deprecated in 4.0 and replaced by lineHeight. As far as I know, there's no way to create a font with a specific set of parameters such as lineHeight; you get the system fonts and that's it.

There is no spacing parameter in UILabel, either.

I'm not particularly happy with UILabel's behavior as is, so I suggest writing your own subclass. That will make the behavior independent of your font choice and be the most reusable solution.

I wish there was more flexibility in UILabel, and I'd be happy to be proven wrong!

AndrewS
I have done it with sub-classing UILabel, basically idea is to divide label text into tokens, and then identity length of each token, create a separate label for each token and append one after another. Thats it.
Matrix