Regarding IOS UIlable, a line breaks before the line is full

Regarding UIlabel line-breaking, it appears that the previous line can still display words, but it directly displays the line following the word following.

Solution: Use rich text display and add setting requirements.  

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];

paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;

NSDictionary *attributes = @{NSParagraphStyleAttributeName:paragraphStyle};

UIlable *notesLabel = [[UILabel alloc]init];

notesLabel.numberOfLines = 0;

notesLabel.attributedText = [[NSAttributedString alloc] initWithString:@“showContext” attributes:attributes];

 

Guess you like

Origin www.cnblogs.com/GUANGANJIUQI/p/iOS.html