mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
fix(core): proper line-height calculation (#10642)
This commit is contained in:

committed by
GitHub

parent
4f46815b27
commit
ec7fa5d05e
@ -26,7 +26,8 @@
|
||||
BOOL isTextView = [self isKindOfClass:[UITextView class]];
|
||||
if (lineHeight > 0) {
|
||||
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
paragraphStyle.lineSpacing = lineHeight;
|
||||
// Note: Avoid using lineSpacing as it will append the height as extra space
|
||||
paragraphStyle.minimumLineHeight = lineHeight;
|
||||
// make sure a possible previously set text alignment setting is not lost when line height is specified
|
||||
if ([self isKindOfClass:[UIButton class]]) {
|
||||
paragraphStyle.alignment = ((UIButton*)self).titleLabel.textAlignment;
|
||||
@ -88,7 +89,8 @@
|
||||
BOOL isLabel = [self isKindOfClass:[UILabel class]];
|
||||
if (lineHeight > 0) {
|
||||
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
paragraphStyle.lineSpacing = lineHeight;
|
||||
// Note: Avoid using lineSpacing as it will append the height as extra space
|
||||
paragraphStyle.minimumLineHeight = lineHeight;
|
||||
// make sure a possible previously set text alignment setting is not lost when line height is specified
|
||||
if ([self isKindOfClass:[UIButton class]]) {
|
||||
paragraphStyle.alignment = ((UIButton*)self).titleLabel.textAlignment;
|
||||
|
Reference in New Issue
Block a user