封装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

@@ -86,7 +86,7 @@
if (!_textField) {
_textField = [[UITextField alloc] init];
_textField.delegate = self;
_textField.font = [UIFont systemFontOfSize:15];
_textField.font = [KBFont medium:13];
_textField.textColor = [UIColor colorWithHex:0x1B1F1A];
_textField.clearButtonMode = UITextFieldViewModeWhileEditing;
_textField.returnKeyType = UIReturnKeySearch;
@@ -104,7 +104,7 @@
- (UIButton *)searchButton {
if (!_searchButton) {
_searchButton = [UIButton buttonWithType:UIButtonTypeSystem];
_searchButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_searchButton.titleLabel.font = [KBFont regular:14];
[_searchButton setTitle:@"Search" forState:UIControlStateNormal];
// 绿
[_searchButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

View File

@@ -67,7 +67,7 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
_titleLabel.font = [KBFont medium:14];
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
}
return _titleLabel;

View File

@@ -70,7 +70,7 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightSemibold];
_titleLabel.font = [KBFont regular:14];
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
}
return _titleLabel;

View File

@@ -30,7 +30,7 @@
+ (CGSize)sizeForText:(NSString *)text {
if (text.length == 0) { return CGSizeMake(40, 32); }
CGSize s = [text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}];
CGSize s = [text sizeWithAttributes:@{NSFontAttributeName:[KBFont regular:13]}];
// 12 + 12 32
return CGSizeMake(ceil(s.width) + 24, 32);
}
@@ -40,7 +40,7 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:14];
_titleLabel.font = [KBFont regular:13];
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
}
return _titleLabel;