NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:messageString];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
[paragraphStyle setLineSpacing:10];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, messageString.length)];
self.updateTextView.attributedText = attributedString;
设置完以后UITextView
的font
属性就失效了,要重新设置
[attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, messageString.length)];
网友评论