ios 进阶在iOS开发的道路上越走越远iOS开发技术

UILabel/UITextView等设置行间距

2015-05-08  本文已影响1557人  CoderAO

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

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}]; 
上一篇 下一篇

猜你喜欢

热点阅读