我有两个NSAttributedString,我将它们合并后设置为UILabel中的文本。如果第一个属性字符串超过两行,我希望它被截断,以便第二个属性字符串仍然显示。我该怎么做?
NSLineBreakMode
:NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[style setLineBreakMode:NSLineBreakByWordWrapping];
NSDictionary *attributes = @{/*yourattributes */NSParagraphStyleAttributeName: style};
NSAttributedString = [[NSAttributedString alloc] initWithString:YOUR_TEXT attributes:attributes];
label.font = font;
label.textColor = [UIColor grayColor];