I have a UILabel, the number of lines is set to 0, it is using tail truncation. The label is sized big enough to fit 2 lines of text. If I give it a regular NSString with 3 lines of text where each line is short and has \\n at the and, it will show the first 2 lines and then an ellipse. It looks like: Line 1 Line 2...
But if I use an NSAttributedString with the same text, it combines the 2nd and 3rd lines before truncating the result. It looks like: Line 1 Line 2Line 3
Nothing I've tried short of using CoreText and fixing it line-by-line seems to be able to get this to work correctly.
Any suggestions?
label.lineBreakMode = NSLineBreakByWordWrapping
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.