AliSoftware / OHAttributedLabel

UILabel that supports NSAttributedString
https://github.com/AliSoftware/OHAttributedLabel/wiki
1.51k stars 344 forks source link

OHAttributedLabel doesn't handle multiple lines with attributed strings #172

Closed Ziewvater closed 10 years ago

Ziewvater commented 10 years ago

I'm having issues with setting an OHAttributedLabel's attributed text with an NSAttributedString containing a newline character. The first line of text appears just fine, but any text after the first line is not shown. Switching the label back to a normal UILabel seems to fix this problem. Also, this problem is only occurring for me with an attributed string; setting the text to an NSString with newline characters behaves properly.

It seems like the label isn't resizing properly, because printing out the contents in the debug console shows the full string text, line breaks included. I am using Auto Layout.

AliSoftware commented 10 years ago

Duplicate with #3 #42 #46 #151 #160 and all thoses. Increment your label height so that the last line is drawn because contrary to UIKit, CoreText does not draw a line of text if it does not fit completely in height (see CTFrameSetter in issues)