Calculation / change of height of a substitution line in UILabel

I found that it is not possible to change the line height in a UILabel. Bummer. Furthermore, it seems that the custom fonts that I have chosen to use do not use their own default line heights when used with UILable.

So - did anyone understand the alternative? Is calculating individual rows and creating new UILabels for each row the only solution?

This applies to the dynamic text used in UILabel, without adding manual lines and wrapping words on btw.

+3
source share
3 answers

, CoreText . UILabel. https://github.com/Tuszy/MTLabel

+8

UILabel UITextField -.

+3

You can use this if you are developing for iOS> = 6.0

NSInteger strLength = [myString length];
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
[style setLineSpacing:24];
[attString addAttribute:NSParagraphStyleAttributeName
                  value:style
                  range:NSMakeRange(0, strLength)];
-1
source

Source: https://habr.com/ru/post/1789094/


All Articles