Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
UILabel setLineHeightMultiple:
#import "UILabel+TDKUtil.h"
@implementation UILabel (TDKUtil)
- (void)setLineHeightMultiple:(CGFloat)lineHeightMultiple
NSMutableAttributedString *attributedString = [self.attributedText mutableCopy];
NSMutableParagraphStyle *paragrahStyle = [NSMutableParagraphStyle new];
paragrahStyle.lineHeightMultiple = lineHeightMultiple;
paragrahStyle.lineBreakMode = NSLineBreakByTruncatingTail;
[attributedString addAttribute:NSParagraphStyleAttributeName
range:NSMakeRange(0, attributedString.length)];
[self setAttributedText:attributedString];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.