Skip to content

Commit

Permalink
[attributedlabel] Always update the line height on the attributed str…
Browse files Browse the repository at this point in the history
…ing.

This avoids a bug where setting the line height to the same value doesn't cause the line height to be set on the attributed string if it's been changed.
  • Loading branch information
jverkoey committed Nov 8, 2012
1 parent 758427d commit 36c4ef2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/attributedlabel/src/NIAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,12 @@ - (void)setLinkColor:(UIColor *)linkColor {

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)setLineHeight:(CGFloat)lineHeight {
if (_lineHeight != lineHeight ) {
_lineHeight = lineHeight;
_lineHeight = lineHeight;

if (nil != self.mutableAttributedString) {
CTTextAlignment alignment = [self.class alignmentFromUITextAlignment:self.textAlignment];
CTLineBreakMode lineBreak = [self.class lineBreakModeFromUILineBreakMode:self.lineBreakMode];
[self.mutableAttributedString setTextAlignment:alignment lineBreakMode:lineBreak lineHeight:self.lineHeight];
}
if (nil != self.mutableAttributedString) {
CTTextAlignment alignment = [self.class alignmentFromUITextAlignment:self.textAlignment];
CTLineBreakMode lineBreak = [self.class lineBreakModeFromUILineBreakMode:self.lineBreakMode];
[self.mutableAttributedString setTextAlignment:alignment lineBreakMode:lineBreak lineHeight:self.lineHeight];
}
}

Expand Down

0 comments on commit 36c4ef2

Please sign in to comment.