zoukankan      html  css  js  c++  java
  • 修改UILable的属性,包括行间距等。

            NSDictionary* dic1 = [[NSDictionary alloc]initWithObjectsAndKeys:font,NSFontAttributeName,[@"b5b5b5" toUIColor], NSForegroundColorAttributeName,nil];

            NSDictionary* dic2 = [[NSDictionary alloc]initWithObjectsAndKeys:font,NSFontAttributeName, [@"1c66a8" toUIColor], NSForegroundColorAttributeName,nil];

            NSDictionary* dic3 = [[NSDictionary alloc]initWithObjectsAndKeys:font,NSFontAttributeName,[@"b5b5b5" toUIColor], NSForegroundColorAttributeName,nil];

            NSMutableAttributedString* attrString = [[NSMutableAttributedString alloc] initWithString:text];

            [attrString addAttributes:dic1 range:NSMakeRange(0, 2)];

            [attrString addAttributes:dic2 range:NSMakeRange(2,commentModel.replyUser.length)];

            [attrString addAttributes:dic3 range:NSMakeRange(2+commentModel.replyUser.length,commentModel.parentInfo.content.length+1)];

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

            [paragraphStyle1 setLineSpacing:8];

            [attrString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [text length])];

            _replyFlagLable.attributedText = attrString;

  • 相关阅读:
    windows wsl2 卸载应用
    windows wsl2中ubuntu安装pip3
    href="#"与href="javascript:void(0)"的区别
    JavaScript 变量提升
    虚拟机升级之后.ubuntu找不到网络解决办法
    javascript 全局变量和局部变量
    flask celery使用
    flask magokit使用
    flask 缓存使用
    Linux设置/删除环境变量方法
  • 原文地址:https://www.cnblogs.com/417460188dy/p/4103173.html
Copyright © 2011-2022 走看看