UILabel 行间距方法 可直接调用
来源:互联网 发布:网络优化大师下载 编辑:程序博客网 时间:2024/04/28 08:42
<span style="color:#663366;">直接调用方法就可以了</span>
<span style="color:#663366;"></span>
<span style="color:#663366;">//添加在哪个label上 字符串 行间距大小</span>
<p style="margin-top: 0px; margin-bottom: 0px; font-size: 13px; font-family: Menlo;"><span style="color: rgb(255, 255, 255);">[</span><span style="color: rgb(222, 56, 166);">self</span><span style="color: rgb(255, 255, 255);"> </span><span style="color:#08fa95;">setLabel</span><span style="color:#330033;">:</span><span style="color: rgb(222, 56, 166);">self</span><span style="color:#330033;">.</span><span style="color:#08fa95;">advert</span><span style="color: rgb(255, 255, 255);"> </span><span style="color:#08fa95;">string</span><span style="color: rgb(255, 255, 255);">:</span><span style="color:#330033;">coach.</span><span style="color:#08fa95;">jladvert</span><span style="color: rgb(255, 255, 255);"> </span><span style="color:#08fa95;">withLineSpacing</span><span style="color:#330033;">:</span><span style="color: rgb(139, 135, 255);">2</span><span style="color: rgb(255, 255, 255);">];</span></p><span style="color:#663366;"></span>
<span style="color:#663366;"></span>
<span style="color:#663366;"></span>
<span style="color:#663366;">#pragma mark - 行间距-(void)setLabel:(UILabel *)label string:(NSString *)str withLineSpacing:(CGFloat)space{ NSMutableAttributedString * mas=[[NSMutableAttributedString alloc]init]; NSMutableParagraphStyle * style=[NSMutableParagraphStyle new]; style.alignment=NSTextAlignmentLeft; style.lineSpacing=space; style.lineBreakMode = UILineBreakModeTailTruncation; style.paragraphSpacing=space; NSDictionary * attributesDict=@{ NSFontAttributeName:[UIFont systemFontOfSize:13],<span style="white-space:pre"></span>//label.text字体大小 NSForegroundColorAttributeName:[UIColor blackColor],<span style="white-space:pre"></span>//label.textColor 字体颜色 NSParagraphStyleAttributeName:style }; NSAttributedString *as=[[NSAttributedString alloc]initWithString:str attributes:attributesDict]; [mas appendAttributedString:as]; [label setAttributedText:mas];}</span>
0 0
- UILabel 行间距方法 可直接调用
- UILabel设定行间距方法
- [iOS] UILabel调整行间距方法
- 设置 UILabel的行间距的方法
- UILabel行间距控制
- ios UIlabel 行间距
- UILabel 调整行间距
- UILabel 设置行间距
- UILabel 行间距
- UILabel的行间距
- UILabel 行间距
- UILabel的行间距
- UILabel 调整行间距
- UILabel设置行间距
- UILabel的行间距
- UIlabel 行间距处理
- UIlabel调整行间距
- UILabel修改行间距
- git rm简介
- javascript删除html结点操作
- javamail添加邮件附件时德文、中文乱码的问题
- Aix 上NFS详细介绍
- Android中异步消息处理机制
- UILabel 行间距方法 可直接调用
- UML资料整合
- 盒子模型1
- EP4: 无偏博弈和数学游戏
- PHP程序员的技术成长规划
- CCNode的tag
- 命令行下打包并导出ipa测试
- C# 解压缩文件帮助类
- Android 4.4 Webservice进行电话查询