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;

posted on 2014-11-17 11:20  童话DY  阅读(134)  评论(0编辑  收藏  举报