- (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;
}
网友评论