[objective-c]UILabelの行間を設定
UILabelの行間を設定
-(void)setLineHeight:(UILabel*)label lineHeight:(float)lineHeight{ NSMutableParagraphStyle *paragrahStyle = [[NSMutableParagraphStyle alloc] init]; paragrahStyle.minimumLineHeight = lineHeight; paragrahStyle.maximumLineHeight = lineHeight; NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:label.text]; [attributedText addAttribute:NSParagraphStyleAttributeName value:paragrahStyle range:NSMakeRange(0, attributedText.length)]; label.attributedText = attributedText; }