zoukankan      html  css  js  c++  java
  • iOS -- YYText富文本

    NSMutableAttributedString *text  = [[NSMutableAttributedString alloc] initWithString: [NSString stringWithFormat:@"%@", kRealName]];
        [text setYy_color:kDarkColor];
        NSMutableAttributedString *one  = [[NSMutableAttributedString alloc] initWithString: [NSString stringWithFormat:@"(%@)", kRole_name]];
        [one setYy_color:WhiteColor];
        [text appendAttributedString:one];
        titleLabel.attributedText = text;
        text.yy_lineSpacing = 5;
        text.yy_font = [UIFont systemFontOfSize:14];
       // text.yy_color = ThemeColor;
        __weak typeof(self) weakself = self;
       /*
        [text yy_setTextHighlightRange:NSMakeRange(10, 7) color:UIColorFromRGBValue(0x22b4e1) backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
            NSLog(@"xxx协议被点击了");
            
        }];
        */
        titleLabel.numberOfLines = 0;  //设置多行显示
        titleLabel.preferredMaxLayoutWidth = kScreenWidth - 30; //设置最大的宽度
        titleLabel.attributedText = text;  //设置富文本
  • 相关阅读:
    react创建项目01
    jq中的时间转化
    vue-resource调用promise取数据方式整理
    ES6 语法
    js获取时间
    trigger()模拟事件操作
    移动端调出不同需求的键盘
    移动端ios滚动卡顿问题
    godaddy购买的域名解析到aws的route53
    k8s 排错
  • 原文地址:https://www.cnblogs.com/mafeng/p/7305271.html
Copyright © 2011-2022 走看看