美文网首页
iOS富文本设置尾部间距

iOS富文本设置尾部间距

作者: 学无止境666 | 来源:发表于2020-04-20 15:56 被阅读0次
    - (void)setAttributeStringForValueLabel:(UILabel *)label text:(NSString *)text
    {
        NSMutableAttributedString *attrString = [[NSMutableAttributedString
                                                  alloc] initWithString:text];
        NSUInteger length = [text length];
        NSMutableParagraphStyle *
        style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
        style.tailIndent = -PASFactor(5); //设置与尾部的距离
        style.alignment = NSTextAlignmentRight;//靠右显示
        [attrString addAttribute:NSParagraphStyleAttributeName value:style
                           range:NSMakeRange(0, length)];
        label.attributedText = attrString;
    }
    

    相关文章

      网友评论

          本文标题:iOS富文本设置尾部间距

          本文链接:https://www.haomeiwen.com/subject/nrwqvhtx.html