美文网首页
iOS UILabel行间距字间距

iOS UILabel行间距字间距

作者: 倪大头 | 来源:发表于2019-11-30 16:06 被阅读0次
NSMutableDictionary *attr = [NSMutableDictionary dictionary];
//字间距(NSKernAttributeName)
attr[NSKernAttributeName] = @5;
//行间距(NSParagraphStyleAttributeName)
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:5];
attr[NSParagraphStyleAttributeName] = paragraphStyle;

myLabel.attributedText = [[NSAttributedString alloc]initWithString:myLabel.text attributes:attr];
myLabel.numberOfLines = 0;
myLabel.lineBreakMode = NSLineBreakByWordWrapping;

相关文章

网友评论

      本文标题:iOS UILabel行间距字间距

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