Quantcast
Channel: Cocoanetics
Viewing all articles
Browse latest Browse all 428

Radar: UITextView Ignores Minimum/Maximum Line Height in Attributed String

$
0
0

I’m working on making DTCoreText iOS 6 compatible and when implementing line heights I found this problem. Naturally I filed a radar.

This is one of many shortcomings of UIKit’s support for attributed strings. A workaround for this was described as having to omit font attributes from the attributed string. So you can either have multiple fonts and unchanging line height or only the font you set on the font property of UITextView.

Other people are having the same problem, as outlined by this question on StackOverflow.

Filed as rdar://12863734

 

Summary

If an attributed string contains both a font attribute as well as a paragraph style attribute that sets minimum/maximum line height those line height constraints are ignored.

Steps to Reproduce

Create an attributed string that contains a font and paragraph style attribute. Make sure the paragraph style attribute sets a minimum and maximum line height that is less than the font line height.
Set this attributed string on a UITextView’s attributedString property.

Expected Results

The lines should be spaced by the amount of the specified minimum/maximum.

Actual Results

The lines are spaced as they would be without the paragraph style settings.

Regression

UITextView only supports attributed strings since iOS 6. Since then this is broken.

Notes

The problem seems to result if you have multiple different fonts, like when you have some bold or italic text in the string.

 

flattr this!


Viewing all articles
Browse latest Browse all 428

Trending Articles