标签:
- (void)setColumnSpace:(CGFloat)columnSpace
{
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:self.attributedText];
//调整间距
[attributedString addAttribute:(__bridge NSString *)kCTKernAttributeName value:@(columnSpace) range:NSMakeRange(0, [attributedString length])];
self.attributedText = attributedString;
}
- (void)setRowSpace:(CGFloat)rowSpace
{
self.numberOfLines = 0;
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:self.attributedText];
//调整行距
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = rowSpace;
paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [self.text length])];
self.attributedText = attributedString;
}
标签:
原文地址:http://www.cnblogs.com/wenqianww/p/5417460.html