Line spacing in UITextView mess up with Text background

170 Views Asked by At

I have a UITextView (custom one) that have some ranges of text with background (like you can see in the first image). The UITextView is not editable (editable = NO).

You can see it in http://cl.ly/image/432A2Z3r0a0u

Now, if i want to change the line spacing, lets say 33 pts:

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 33;
[textAttributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [textAttributedString length])];

then the Background is mess up http://cl.ly/image/1E33240h0f0V, The main idea is that the background color do not grow with the line height.

0

There are 0 best solutions below