Swift/OC
来源:互联网 发布:电磁场有限元分析软件 编辑:程序博客网 时间:2024/06/10 03:38
这个没什么好讲的,直接上代码,知道swift中设置行间距的样式就行。附加上OC版设置:
Swift4.0 let paragraphStye = NSMutableParagraphStyle() //调整行间距 paragraphStye.lineSpacing = 5.0 paragraphStye.lineBreakMode = NSLineBreakMode.byWordWrapping let attributedString = NSMutableAttributedString.init(string: self.contentLab.text!, attributes: [NSAttributedStringKey.paragraphStyle:paragraphStye]) self.contentLab.attributedText = attributedString
OC版:NSMutableAttributedString *attriText = [[NSMutableAttributedString alloc] initWithString:content];NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];[paragraphStyle setLineSpacing:5];[paragraphStyle setLineBreakMode:NSLineBreakByWordWrapping];[attriText addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:fontSize],NSForegroundColorAttributeName:UIColorFromRGB(0x333333,1),NSParagraphStyleAttributeName:paragraphStyle} range:NSMakeRange(0, content.length)];
有问题请发送邮件到:584379066@qq.com , 请备注
阅读全文
0 0
- Swift/OC
- oc与swift混编,OC调用swift,swift调用OC
- OC To Swift And Swift To OC
- Swift 混编 OC , OC 混编 Swift
- [iOS]#Swift#OC+Swift混编
- Swift Swift和OC混编
- Swift与OC混编
- OC与Swift混编
- swift or oc?
- oc 和 swift 混编
- Swift invoke OC
- OC与Swift混编
- OC调用Swift
- oc swift 混编 特技
- Swift和OC混用
- Swift和OC混编
- Swift OC 混编
- OC与Swift混编
- 无限轮播
- PAT 甲级 1003. Emergency (25)
- 最大元,归并排序作业
- 2017年进口食品代理加盟排行榜
- 负载均衡SLB百问FAQ
- Swift/OC
- Oracle 总结
- CentOS 7 中使用NTP进行时间同步
- memach类型转换异常java.lang.ClassCastException: java.lang.Byte cannot be cast to com.organization.model.
- SQL Server 2008中的代码安全(八) 透明数据加密(TDE)
- JAVA-Interface关键字
- 著名软件错误案例
- nfs常见问题解决办法
- 序列定时重置时,存储过程中涉及到DDL语句,执行报错:无法执行作业1