封装KBFont,适配字体

This commit is contained in:
2025-11-25 15:36:16 +08:00
parent 71423df1c0
commit 1eb73f5257
40 changed files with 224 additions and 101 deletions

View File

@@ -154,6 +154,7 @@
KBTopImageButton *btn = self.featureButtons[i];
if (i < count) {
btn.textLabel.text = titles[i];
btn.textLabel.font = [KBFont regular:12];
}
UIImage *img = (i < images.count) ? images[i] : nil;
btn.iconView.image = img;
@@ -188,7 +189,8 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold];
// _titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold];
_titleLabel.font = [KBFont bold:18];
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
_titleLabel.textAlignment = NSTextAlignmentCenter;
}
@@ -198,7 +200,8 @@
- (UILabel *)subTitleLabel {
if (!_subTitleLabel) {
_subTitleLabel = [[UILabel alloc] init];
_subTitleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
// _subTitleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
_subTitleLabel.font = [KBFont regular:14];
_subTitleLabel.textColor = self.titleLabel.textColor;
_subTitleLabel.textAlignment = NSTextAlignmentCenter;
}
@@ -236,7 +239,8 @@
_buyButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_buyButton setTitle:KBLocalized(@"Recharge Now") forState:UIControlStateNormal];
[_buyButton setTitleColor:[UIColor colorWithHex:0x1B1F1A] forState:UIControlStateNormal];
_buyButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
// _buyButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
_buyButton.titleLabel.font = [KBFont medium:15];
[_buyButton setBackgroundImage:[UIImage imageNamed:@"recharge_now_icon"] forState:UIControlStateNormal];
[_buyButton addTarget:self action:@selector(onTapBuyAction) forControlEvents:UIControlEventTouchUpInside];
}

View File

@@ -121,7 +121,7 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_titleLabel.font = [KBFont medium:16];
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
}
return _titleLabel;
@@ -130,7 +130,7 @@
- (UILabel *)subLabel {
if (!_subLabel) {
_subLabel = [[UILabel alloc] init];
_subLabel.font = [UIFont systemFontOfSize:12];
_subLabel.font = [KBFont regular:12];
_subLabel.textColor = [UIColor colorWithHex:0x9A9A9A];
_subLabel.numberOfLines = 2;
}

View File

@@ -159,7 +159,7 @@
if (!_titleLabel) {
_titleLabel = [UILabel new];
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_titleLabel.font = [KBFont medium:16];
_titleLabel.textAlignment = NSTextAlignmentCenter;
}
return _titleLabel;
@@ -169,7 +169,7 @@
if (!_descLabel) {
_descLabel = [UILabel new];
_descLabel.textColor = [UIColor colorWithHex:0x9A9A9A];
_descLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
_descLabel.font = [KBFont regular:12];
_descLabel.textAlignment = NSTextAlignmentCenter;
_descLabel.numberOfLines = 2;
}
@@ -180,7 +180,7 @@
if (!_peopleLabel) {
_peopleLabel = [UILabel new];
_peopleLabel.textColor = [UIColor colorWithHex:KBColorValue];
_peopleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightRegular];
_peopleLabel.font = [KBFont regular:10];
_peopleLabel.textAlignment = NSTextAlignmentCenter;
_peopleLabel.numberOfLines = 2;
}

View File

@@ -174,7 +174,7 @@
if (!_titleLabel) {
_titleLabel = [UILabel new];
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_titleLabel.font = [KBFont medium:16];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.text = @"High EQ"; //
}
@@ -186,7 +186,7 @@
_downloadLabel = [UILabel new];
_downloadLabel.textColor = [UIColor colorWithHex:KBColorValue];
_downloadLabel.backgroundColor = [UIColor colorWithHex:0xEDFFFD];
_downloadLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
_downloadLabel.font = [KBFont regular:13];
_downloadLabel.textAlignment = NSTextAlignmentCenter;
_downloadLabel.text = @"Download: 1 Million";
}
@@ -207,7 +207,7 @@
if (!_descLabel) {
_descLabel = [UILabel new];
_descLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_descLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold];
_descLabel.font = [KBFont medium:14];
_descLabel.numberOfLines = 0;
_descLabel.text = @"Be Neither Too Close\nNor Too Distant";
}
@@ -219,7 +219,7 @@
_saveButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_saveButton setTitle:@"Save" forState:UIControlStateNormal];
[_saveButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
_saveButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
_saveButton.titleLabel.font = [KBFont medium:16];
_saveButton.backgroundColor = [UIColor colorWithRed:0.02 green:0.75 blue:0.67 alpha:1.0];
_saveButton.layer.cornerRadius = 24.0;
_saveButton.layer.masksToBounds = YES;

View File

@@ -112,7 +112,7 @@
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = [UIColor colorWithWhite:0.1 alpha:1];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_titleLabel.font = [KBFont medium:13];
_titleLabel.textAlignment = NSTextAlignmentCenter;
}
return _titleLabel;