瀏覽代碼

Fix title.font when subtitle supplied

yogevbd 5 年之前
父節點
當前提交
14a5b748fa
共有 1 個檔案被更改,包括 3 行新增7 行删除
  1. 3
    7
      lib/ios/RNNTitleViewHelper.m

+ 3
- 7
lib/ios/RNNTitleViewHelper.m 查看文件

@@ -127,14 +127,10 @@
127 127
 	
128 128
 	titleLabel.autoresizingMask = self.titleView.autoresizingMask;
129 129
 	
130
-	UIFont *titleFont = [UIFont boldSystemFontOfSize:17.f];
130
+	NSDictionary* fontAttributes = [RNNFontAttributesCreator createFontAttributesWithFontFamily:[_titleOptions.fontFamily getWithDefaultValue:nil] fontSize:[_titleOptions.fontSize getWithDefaultValue:nil] color:[_subtitleOptions.color getWithDefaultValue:nil]];
131
+	[titleLabel setAttributedText:[[NSAttributedString alloc] initWithString:self.title attributes:fontAttributes]];
131 132
 	
132
-	CGFloat fontSizeFloat = [RCTConvert CGFloat:[_titleOptions.fontSize getWithDefaultValue:@(17)]];
133
-	titleFont = [UIFont boldSystemFontOfSize:fontSizeFloat];
134
-	
135
-	[titleLabel setAttributedText:[[NSAttributedString alloc] initWithString:self.title attributes:_titleOptions.fontAttributes]];
136
-	
137
-	CGSize labelSize = [titleLabel.text sizeWithAttributes:@{NSFontAttributeName:titleFont}];
133
+	CGSize labelSize = [titleLabel.text sizeWithAttributes:fontAttributes];
138 134
 	CGRect labelframe = titleLabel.frame;
139 135
 	labelframe.size = labelSize;
140 136
 	titleLabel.frame = labelframe;