封装KBFont,适配字体
This commit is contained in:
@@ -122,7 +122,7 @@
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = KBLocalized(@"Change The Nickname");
|
||||
_titleLabel.textColor = [UIColor blackColor];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:22 weight:UIFontWeightBold];
|
||||
_titleLabel.font = [KBFont medium:16];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
@@ -159,7 +159,7 @@
|
||||
if (!_textField) {
|
||||
_textField = [[UITextField alloc] init];
|
||||
_textField.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
_textField.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
|
||||
_textField.font = [KBFont medium:16];
|
||||
_textField.textColor = [UIColor blackColor];
|
||||
_textField.placeholder = KBLocalized(@"Please Enter The Modified Nickname");
|
||||
}
|
||||
@@ -171,8 +171,8 @@
|
||||
_saveButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_saveButton setTitle:KBLocalized(@"Save") forState:UIControlStateNormal];
|
||||
[_saveButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
_saveButton.titleLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
|
||||
_saveButton.backgroundColor = [UIColor colorWithRed:0.02 green:0.75 blue:0.67 alpha:1.0];
|
||||
_saveButton.titleLabel.font = [KBFont medium:16];
|
||||
_saveButton.backgroundColor = [UIColor colorWithHex:KBColorValue];
|
||||
_saveButton.layer.cornerRadius = 28.0; _saveButton.layer.masksToBounds = YES; // 胶囊按钮
|
||||
[_saveButton addTarget:self action:@selector(onTapSave) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
if (![label isKindOfClass:UILabel.class]) {
|
||||
label = [[UILabel alloc] init];
|
||||
label.textAlignment = NSTextAlignmentCenter;
|
||||
label.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
|
||||
label.font = [KBFont medium:16];
|
||||
}
|
||||
NSString *name = self.items[row][@"name"] ?: @"";
|
||||
label.text = name;
|
||||
@@ -178,7 +178,7 @@
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = @"Modify Gender";
|
||||
_titleLabel.textColor = [UIColor blackColor];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:22 weight:UIFontWeightBold];
|
||||
_titleLabel.font = [KBFont medium:16];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
@@ -222,7 +222,7 @@
|
||||
_saveButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_saveButton setTitle:@"Save" forState:UIControlStateNormal];
|
||||
[_saveButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
||||
_saveButton.titleLabel.font = [UIFont systemFontOfSize:20 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 = 23.0; _saveButton.layer.masksToBounds = YES;
|
||||
[_saveButton addTarget:self action:@selector(onTapSave) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
@@ -107,8 +107,8 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = KBLocalized(@"Settings"); // 大标题
|
||||
_titleLabel.font = [UIFont systemFontOfSize:30 weight:UIFontWeightBold];
|
||||
_titleLabel.text = KBLocalized(@"Personal"); // 大标题
|
||||
_titleLabel.font = [KBFont bold:30];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
}
|
||||
return _titleLabel;
|
||||
@@ -118,7 +118,7 @@
|
||||
if (!_keyboardBtn) {
|
||||
_keyboardBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_keyboardBtn setTitle:KBLocalized(@"My Keyboard") forState:UIControlStateNormal];
|
||||
_keyboardBtn.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightSemibold];
|
||||
_keyboardBtn.titleLabel.font = [KBFont medium:10];
|
||||
[_keyboardBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_keyboardBtn.backgroundColor = [UIColor colorWithHex:KBColorValue];
|
||||
_keyboardBtn.layer.cornerRadius = 17;
|
||||
@@ -129,7 +129,7 @@
|
||||
if (kbImg) {
|
||||
[_keyboardBtn setImage:kbImg forState:UIControlStateNormal];
|
||||
_keyboardBtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
CGFloat spacing = 6.0;
|
||||
CGFloat spacing = 3.0;
|
||||
_keyboardBtn.contentEdgeInsets = UIEdgeInsetsMake(0, spacing, 0, spacing);
|
||||
_keyboardBtn.titleEdgeInsets = UIEdgeInsetsMake(0, spacing, 0, -spacing);
|
||||
}
|
||||
@@ -156,8 +156,8 @@
|
||||
if (!_nameLabel) {
|
||||
_nameLabel = [UILabel new];
|
||||
_nameLabel.text = @"Notice";
|
||||
_nameLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
|
||||
_nameLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
_nameLabel.font = [KBFont medium:20];
|
||||
_nameLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
}
|
||||
return _nameLabel;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
+ (CGSize)sizeForEmoji:(NSString *)emoji title:(NSString *)title {
|
||||
// 固定高度 44,宽度 = 左右内边距(12+12) + Emoji 宽(按 20 号字估算) + 间距(8) + 文案宽
|
||||
UIFont *emojiFont = [UIFont systemFontOfSize:20];
|
||||
UIFont *titleFont = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
UIFont *titleFont = [KBFont regular:13];
|
||||
|
||||
CGFloat emojiW = 0;
|
||||
if (emoji.length > 0) {
|
||||
@@ -128,7 +128,7 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
_titleLabel.font = [KBFont regular:13];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
}
|
||||
return _titleLabel;
|
||||
|
||||
@@ -98,8 +98,8 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:16];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:0x222222];
|
||||
_titleLabel.font = [KBFont medium:16];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_titleLabel.text = @"Title";
|
||||
}
|
||||
return _titleLabel;
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
|
||||
_titleLabel.font = [KBFont medium:16];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
@@ -158,7 +158,7 @@
|
||||
if (!_valueLabel) {
|
||||
_valueLabel = [UILabel new];
|
||||
_valueLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_valueLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
_valueLabel.font = [KBFont bold:16];
|
||||
_valueLabel.textAlignment = NSTextAlignmentRight;
|
||||
[_valueLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:17 weight:UIFontWeightSemibold];
|
||||
_titleLabel.font = [KBFont medium:16];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
@@ -143,7 +143,7 @@
|
||||
- (UILabel *)priceLabel {
|
||||
if (!_priceLabel) {
|
||||
_priceLabel = [[UILabel alloc] init];
|
||||
_priceLabel.font = [UIFont systemFontOfSize:17 weight:UIFontWeightSemibold];
|
||||
_priceLabel.font = [KBFont medium:16];
|
||||
_priceLabel.textColor = [UIColor whiteColor];
|
||||
_priceLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
- (UILabel *)leftLabel {
|
||||
if (!_leftLabel) {
|
||||
_leftLabel = [UILabel new];
|
||||
_leftLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
_leftLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
|
||||
_leftLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_leftLabel.font = [KBFont medium:16];
|
||||
_leftLabel.text = @"Dopamine";
|
||||
}
|
||||
return _leftLabel;
|
||||
@@ -67,7 +67,7 @@
|
||||
if (!_rightLabel) {
|
||||
_rightLabel = [UILabel new];
|
||||
_rightLabel.textColor = [UIColor colorWithHex:KBColorValue];
|
||||
_rightLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
||||
_rightLabel.font = [KBFont regular:13];
|
||||
_rightLabel.textAlignment = NSTextAlignmentRight;
|
||||
_rightLabel.text = @"Download: 1 Million";
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
|
||||
_titleLabel.font = [KBFont medium:14];
|
||||
_titleLabel.text = @"Recommended Skin";
|
||||
}
|
||||
return _titleLabel;
|
||||
|
||||
@@ -167,8 +167,8 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:0x333333];
|
||||
_titleLabel.font = [KBFont regular:14];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_titleLabel.text = @"Dopamine";
|
||||
}
|
||||
return _titleLabel;
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
_textView = [[UITextView alloc] init];
|
||||
_textView.delegate = self;
|
||||
_textView.backgroundColor = [UIColor clearColor];
|
||||
_textView.font = [UIFont systemFontOfSize:16];
|
||||
_textView.font = [KBFont medium:14];
|
||||
_textView.textColor = [UIColor blackColor];
|
||||
_textView.textContainerInset = UIEdgeInsetsZero;
|
||||
_textView.textContainer.lineFragmentPadding = 0;
|
||||
@@ -129,7 +129,7 @@
|
||||
if (!_placeholderLabel) {
|
||||
_placeholderLabel = [UILabel new];
|
||||
_placeholderLabel.textColor = [UIColor colorWithWhite:0.75 alpha:1.0];
|
||||
_placeholderLabel.font = [UIFont systemFontOfSize:16];
|
||||
_placeholderLabel.font = [KBFont medium:14];
|
||||
_placeholderLabel.text = KBLocalized(@"Please Enter The Content");
|
||||
}
|
||||
return _placeholderLabel;
|
||||
@@ -138,8 +138,8 @@
|
||||
- (UILabel *)countLabel {
|
||||
if (!_countLabel) {
|
||||
_countLabel = [UILabel new];
|
||||
_countLabel.textColor = [UIColor colorWithWhite:0.7 alpha:1.0];
|
||||
_countLabel.font = [UIFont systemFontOfSize:14];
|
||||
_countLabel.textColor = [UIColor colorWithHex:0xACACAC];
|
||||
_countLabel.font = [KBFont regular:13];
|
||||
_countLabel.textAlignment = NSTextAlignmentRight;
|
||||
_countLabel.text = @"0/100";
|
||||
}
|
||||
@@ -151,7 +151,7 @@
|
||||
_commitButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_commitButton setTitle:KBLocalized(@"Commit") forState:UIControlStateNormal];
|
||||
[_commitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_commitButton.titleLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
|
||||
_commitButton.titleLabel.font = [KBFont medium:16];
|
||||
// 使用与修改昵称弹窗相近的主色
|
||||
_commitButton.backgroundColor = [UIColor colorWithRed:0.02 green:0.75 blue:0.67 alpha:1.0];
|
||||
_commitButton.layer.cornerRadius = 28.0;
|
||||
|
||||
@@ -261,7 +261,7 @@ static NSString * const kKBMyKeyboardCellId = @"kKBMyKeyboardCellId";
|
||||
if (!_saveButton) {
|
||||
_saveButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[_saveButton setTitle:KBLocalized(@"Save") forState:UIControlStateNormal];
|
||||
_saveButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
|
||||
_saveButton.titleLabel.font = [KBFont medium:16];
|
||||
[_saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_saveButton.backgroundColor = [UIColor colorWithHex:KBColorValue];
|
||||
_saveButton.layer.cornerRadius = 25;
|
||||
|
||||
@@ -75,8 +75,8 @@
|
||||
- (UILabel *)noticeTitleLabel {
|
||||
if (!_noticeTitleLabel) {
|
||||
_noticeTitleLabel = [UILabel new];
|
||||
_noticeTitleLabel.textColor = [UIColor blackColor];
|
||||
_noticeTitleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
|
||||
_noticeTitleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_noticeTitleLabel.font = [KBFont medium:16];
|
||||
// 文案可根据需要在 Localizable.strings 中配置多语言
|
||||
_noticeTitleLabel.text = KBLocalized(@"Notification Setting");
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@
|
||||
_modifyLabel = [UILabel new];
|
||||
_modifyLabel.text = @"Modify";
|
||||
_modifyLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_modifyLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
|
||||
_modifyLabel.font = [KBFont bold:18];
|
||||
}
|
||||
return _modifyLabel;
|
||||
}
|
||||
@@ -281,9 +281,9 @@
|
||||
- (UIButton *)logoutBtn {
|
||||
if (!_logoutBtn) {
|
||||
_logoutBtn = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[_logoutBtn setTitle:@"Log Out" forState:UIControlStateNormal];
|
||||
[_logoutBtn setTitle:KBLocalized(@"Log Out") forState:UIControlStateNormal];
|
||||
[_logoutBtn setTitleColor:[UIColor colorWithHex:0xFF0000] forState:UIControlStateNormal];
|
||||
_logoutBtn.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
_logoutBtn.titleLabel.font = [KBFont medium:16];
|
||||
_logoutBtn.backgroundColor = UIColor.whiteColor;
|
||||
_logoutBtn.layer.cornerRadius = 12; _logoutBtn.layer.masksToBounds = YES;
|
||||
[_logoutBtn addTarget:self action:@selector(onTapLogout) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
@@ -281,8 +281,8 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
|
||||
- (UILabel *)selectedLabel {
|
||||
if (!_selectedLabel) {
|
||||
_selectedLabel = [UILabel new];
|
||||
_selectedLabel.textColor = [UIColor colorWithHex:0x666666];
|
||||
_selectedLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_selectedLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_selectedLabel.font = [KBFont medium:13];
|
||||
// _selectedLabel.text = @"Selected: 0 Skins";
|
||||
}
|
||||
return _selectedLabel;
|
||||
@@ -292,7 +292,7 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
|
||||
if (!_deleteButton) {
|
||||
_deleteButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[_deleteButton setTitle:KBLocalized(@"Delete") forState:UIControlStateNormal];
|
||||
_deleteButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
_deleteButton.titleLabel.font = [KBFont medium:13];
|
||||
_deleteButton.layer.cornerRadius = 18;
|
||||
_deleteButton.layer.borderWidth = 1;
|
||||
_deleteButton.clipsToBounds = YES;
|
||||
|
||||
Reference in New Issue
Block a user