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;

  • 相关阅读:
    POJ 3280 Cheapest Palindrome
    POJ 1191 棋盘分割
    POJ 1260 Pearls
    HDOJ 4731 Minimum palindrome
    2013 ACM/ICPC Asia Regional Chengdu Online 1004 Minimum palindrome
    POJ 1836 Alignment
    POJ 3267 The Cow Lexicon
    POJ 1276 Cash Machine
    POJ 1837 Balance
    HDU 4554 叛逆的小明
  • 原文地址:https://www.cnblogs.com/417460188dy/p/4103173.html
Copyright © 2011-2022 走看看