UILabel/UITextView等设置行间距

作者: CoderAO | 来源:发表于2015-05-08 16:10 被阅读1557次

// 先初始化一个段落样式

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

// 调整行间距

[paragraphStyle setLineSpacing:3];
self.descLabel.attributedText =[[NSAttributedString alloc] initWithString: _model.desc                                   
attributes:@{NSFontAttributeName: 
[UIFont systemFontOfSize:11.f],                                                
NSForegroundColorAttributeName:[UIColor redColor],                                                NSParagraphStyleAttributeName:paragraphStyle}]; 

相关文章

网友评论

本文标题:UILabel/UITextView等设置行间距

本文链接:https://www.haomeiwen.com/subject/myvwfttx.html