Skip to content

Commit

Permalink
Merge pull request #1285 from alibaba/ios-bugfix-text-lineHeight
Browse files Browse the repository at this point in the history
* [ios] fix style line-height conflict with text-align
  • Loading branch information
cxfeng1 committed Sep 25, 2016
2 parents c49ba2a + e762637 commit 859ef3b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -261,24 +261,23 @@ - (NSAttributedString *)buildAttributeString
} else if(_textDecoration == WXTextDecorationLineThrough){
[attributedString addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, string.length)];
}

NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
if (_textAlign) {
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.alignment = _textAlign;
[attributedString addAttribute:NSParagraphStyleAttributeName
value:paragraphStyle
range:(NSRange){0, attributedString.length}];
}

if (_lineHeight) {
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.maximumLineHeight = _lineHeight;
paragraphStyle.minimumLineHeight = _lineHeight;
}

if (_lineHeight || _textAlign) {
[attributedString addAttribute:NSParagraphStyleAttributeName
value:paragraphStyle
range:(NSRange){0, attributedString.length}];
}


return attributedString;
}

Expand Down

0 comments on commit 859ef3b

Please sign in to comment.