diff --git a/keyBoard/Assets.xcassets/My/black_right_arrow.imageset/Contents.json b/keyBoard/Assets.xcassets/My/black_right_arrow.imageset/Contents.json new file mode 100644 index 0000000..2d0b67b --- /dev/null +++ b/keyBoard/Assets.xcassets/My/black_right_arrow.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "black_right_arrow@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "black_right_arrow@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/keyBoard/Assets.xcassets/My/black_right_arrow.imageset/black_right_arrow@2x.png b/keyBoard/Assets.xcassets/My/black_right_arrow.imageset/black_right_arrow@2x.png new file mode 100644 index 0000000..5287f08 Binary files /dev/null and b/keyBoard/Assets.xcassets/My/black_right_arrow.imageset/black_right_arrow@2x.png differ diff --git a/keyBoard/Assets.xcassets/My/black_right_arrow.imageset/black_right_arrow@3x.png b/keyBoard/Assets.xcassets/My/black_right_arrow.imageset/black_right_arrow@3x.png new file mode 100644 index 0000000..662cb54 Binary files /dev/null and b/keyBoard/Assets.xcassets/My/black_right_arrow.imageset/black_right_arrow@3x.png differ diff --git a/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/Contents.json b/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/Contents.json new file mode 100644 index 0000000..4ad7125 --- /dev/null +++ b/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "my_bg_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "my_bg_icon 1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "my_bg_icon 2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/my_bg_icon 1.png b/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/my_bg_icon 1.png new file mode 100644 index 0000000..defa1d2 Binary files /dev/null and b/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/my_bg_icon 1.png differ diff --git a/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/my_bg_icon 2.png b/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/my_bg_icon 2.png new file mode 100644 index 0000000..defa1d2 Binary files /dev/null and b/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/my_bg_icon 2.png differ diff --git a/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/my_bg_icon.png b/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/my_bg_icon.png new file mode 100644 index 0000000..defa1d2 Binary files /dev/null and b/keyBoard/Assets.xcassets/My/my_bg_icon.imageset/my_bg_icon.png differ diff --git a/keyBoard/Class/Home/V/HomeRankCardCell.m b/keyBoard/Class/Home/V/HomeRankCardCell.m index fe490cb..6dce938 100644 --- a/keyBoard/Class/Home/V/HomeRankCardCell.m +++ b/keyBoard/Class/Home/V/HomeRankCardCell.m @@ -179,7 +179,7 @@ - (UILabel *)peopleLabel { if (!_peopleLabel) { _peopleLabel = [UILabel new]; - _peopleLabel.textColor = [UIColor colorWithHex:KBColor]; + _peopleLabel.textColor = [UIColor colorWithHex:KBColorValue]; _peopleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightRegular]; _peopleLabel.textAlignment = NSTextAlignmentCenter; _peopleLabel.numberOfLines = 2; diff --git a/keyBoard/Class/Me/V/KBMyHeaderView.h b/keyBoard/Class/Me/V/KBMyHeaderView.h index 91c802f..45c2fe4 100644 --- a/keyBoard/Class/Me/V/KBMyHeaderView.h +++ b/keyBoard/Class/Me/V/KBMyHeaderView.h @@ -16,7 +16,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong, readonly) UILabel *nameLabel; // 名称/提示 @property (nonatomic, strong, readonly) UIView *cardLeft; // 左卡片 @property (nonatomic, strong, readonly) UIView *cardRight; // 右卡片 + +/// 点击事件回调(由外部控制器设置)。 +@property (nonatomic, copy) void (^onKeyboardTapped)(void); +@property (nonatomic, copy) void (^onAvatarTapped)(void); +@property (nonatomic, copy) void (^onLeftCardTapped)(void); +@property (nonatomic, copy) void (^onRightCardTapped)(void); @end NS_ASSUME_NONNULL_END - diff --git a/keyBoard/Class/Me/V/KBMyHeaderView.m b/keyBoard/Class/Me/V/KBMyHeaderView.m index e9d38a0..d0d1d1d 100644 --- a/keyBoard/Class/Me/V/KBMyHeaderView.m +++ b/keyBoard/Class/Me/V/KBMyHeaderView.m @@ -14,6 +14,7 @@ @property (nonatomic, strong) UILabel *nameLabel; @property (nonatomic, strong) UIImageView *cardLeft; @property (nonatomic, strong) UIImageView *cardRight; +@property (nonatomic, strong) UIImageView *avatarEditIcon; // 头像右下角的编辑图标 @end @implementation KBMyHeaderView @@ -25,6 +26,7 @@ [self addSubview:self.titleLabel]; [self addSubview:self.keyboardBtn]; [self addSubview:self.avatarView]; + [self addSubview:self.avatarEditIcon]; // 头像右下角编辑图标 [self addSubview:self.nameLabel]; [self addSubview:self.cardLeft]; [self addSubview:self.cardRight]; @@ -38,13 +40,18 @@ make.centerY.equalTo(self.titleLabel); make.right.equalTo(self).offset(-20); make.height.mas_equalTo(34); - make.width.mas_greaterThanOrEqualTo(126); + make.width.mas_greaterThanOrEqualTo(115); }]; [self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self).offset(26); make.bottom.equalTo(self.cardLeft.mas_top).offset(-23); make.width.height.mas_equalTo(70); }]; + [self.avatarEditIcon mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(18); + make.right.equalTo(self.avatarView.mas_right); + make.bottom.equalTo(self.avatarView.mas_bottom); + }]; [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.avatarView); make.left.equalTo(self.avatarView.mas_right).offset(12); @@ -106,12 +113,25 @@ - (UIButton *)keyboardBtn { if (!_keyboardBtn) { _keyboardBtn = [UIButton buttonWithType:UIButtonTypeCustom]; - [_keyboardBtn setTitle:@" My Keyboard " forState:UIControlStateNormal]; + [_keyboardBtn setTitle:@"My Keyboard" forState:UIControlStateNormal]; _keyboardBtn.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightSemibold]; [_keyboardBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - _keyboardBtn.backgroundColor = [UIColor colorWithHex:KBColor]; + _keyboardBtn.backgroundColor = [UIColor colorWithHex:KBColorValue]; _keyboardBtn.layer.cornerRadius = 17; _keyboardBtn.layer.masksToBounds = YES; + + // 图标 + 文本,图文间距 6 + UIImage *kbImg = [UIImage imageNamed:@"my_kb_icon"]; + if (kbImg) { + [_keyboardBtn setImage:kbImg forState:UIControlStateNormal]; + _keyboardBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; + CGFloat spacing = 6.0; + _keyboardBtn.contentEdgeInsets = UIEdgeInsetsMake(0, spacing, 0, spacing); + _keyboardBtn.titleEdgeInsets = UIEdgeInsetsMake(0, spacing, 0, -spacing); + } + + // 点击事件 + [_keyboardBtn addTarget:self action:@selector(onKeyboardTap) forControlEvents:UIControlEventTouchUpInside]; } return _keyboardBtn; } @@ -121,6 +141,9 @@ _avatarView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"lufei.jpg"]]; _avatarView.contentMode = UIViewContentModeScaleAspectFill; _avatarView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0]; + _avatarView.userInteractionEnabled = YES; // 头像可点击 + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onAvatarTap)]; + [_avatarView addGestureRecognizer:tap]; } return _avatarView; } @@ -135,8 +158,43 @@ return _nameLabel; } -- (UIImageView *)cardLeft { if (!_cardLeft) { _cardLeft = [UIImageView new]; _cardLeft.contentMode = UIViewContentModeScaleAspectFit; _cardLeft.image = [UIImage imageNamed:@"my_member_icon"];} return _cardLeft; } -- (UIImageView *)cardRight { if (!_cardRight) { _cardRight = [UIImageView new];_cardRight.contentMode = UIViewContentModeScaleAspectFit; _cardRight.image = [UIImage imageNamed:@"my_recharge_icon"];} return _cardRight; } +- (UIImageView *)cardLeft { + if (!_cardLeft) { + _cardLeft = [UIImageView new]; + _cardLeft.contentMode = UIViewContentModeScaleAspectFit; + _cardLeft.image = [UIImage imageNamed:@"my_member_icon"]; + _cardLeft.userInteractionEnabled = YES; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onLeftCardTap)]; + [_cardLeft addGestureRecognizer:tap]; + } + return _cardLeft; +} +- (UIImageView *)cardRight { + if (!_cardRight) { + _cardRight = [UIImageView new]; + _cardRight.contentMode = UIViewContentModeScaleAspectFit; + _cardRight.image = [UIImage imageNamed:@"my_recharge_icon"]; + _cardRight.userInteractionEnabled = YES; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onRightCardTap)]; + [_cardRight addGestureRecognizer:tap]; + } + return _cardRight; +} + +- (UIImageView *)avatarEditIcon { + if (!_avatarEditIcon) { + _avatarEditIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"my_head_edite"]]; + _avatarEditIcon.contentMode = UIViewContentModeScaleAspectFit; + _avatarEditIcon.userInteractionEnabled = NO; // 仅展示 + } + return _avatarEditIcon; +} + +#pragma mark - Actions +- (void)onKeyboardTap { if (self.onKeyboardTapped) { self.onKeyboardTapped(); } } +- (void)onAvatarTap { if (self.onAvatarTapped) { self.onAvatarTapped(); } } +- (void)onLeftCardTap { if (self.onLeftCardTapped) { self.onLeftCardTapped(); } } +- (void)onRightCardTap { if (self.onRightCardTapped) { self.onRightCardTapped(); } } @end diff --git a/keyBoard/Class/Me/V/KBMyListCell.m b/keyBoard/Class/Me/V/KBMyListCell.m index 5553e73..c42ee4c 100644 --- a/keyBoard/Class/Me/V/KBMyListCell.m +++ b/keyBoard/Class/Me/V/KBMyListCell.m @@ -59,8 +59,8 @@ }]; [self.arrowView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.container); - make.right.equalTo(self.container).offset(-12); - make.width.mas_equalTo(8); + make.right.equalTo(self.container).offset(-16); + make.width.mas_equalTo(9); make.height.mas_equalTo(14); }]; [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) { @@ -109,11 +109,7 @@ if (!_arrowView) { _arrowView = [[UIImageView alloc] init]; _arrowView.contentMode = UIViewContentModeScaleAspectFit; - _arrowView.tintColor = [UIColor colorWithHex:0xC0C0C0]; - // iOS13+ 使用系统图标,老系统可换成本地资源名 - if (@available(iOS 13.0, *)) { - _arrowView.image = [UIImage systemImageNamed:@"chevron.right"]; - } + _arrowView.image = [UIImage imageNamed:@"black_right_arrow"]; } return _arrowView; } diff --git a/keyBoard/Class/Me/V/KBSkinBottomActionView.m b/keyBoard/Class/Me/V/KBSkinBottomActionView.m index 44400f7..898890f 100644 --- a/keyBoard/Class/Me/V/KBSkinBottomActionView.m +++ b/keyBoard/Class/Me/V/KBSkinBottomActionView.m @@ -19,7 +19,7 @@ - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { - self.backgroundColor = [UIColor colorWithHex:KBColor]; + self.backgroundColor = [UIColor colorWithHex:KBColorValue]; self.layer.masksToBounds = YES; // 圆角生效 // 高亮态轻微透明,突出点击感 diff --git a/keyBoard/Class/Me/V/KBSkinDetailHeaderCell.m b/keyBoard/Class/Me/V/KBSkinDetailHeaderCell.m index 87678ce..64288fc 100644 --- a/keyBoard/Class/Me/V/KBSkinDetailHeaderCell.m +++ b/keyBoard/Class/Me/V/KBSkinDetailHeaderCell.m @@ -65,7 +65,7 @@ - (UILabel *)rightLabel { if (!_rightLabel) { _rightLabel = [UILabel new]; - _rightLabel.textColor = [UIColor colorWithHex:KBColor]; + _rightLabel.textColor = [UIColor colorWithHex:KBColorValue]; _rightLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; _rightLabel.textAlignment = NSTextAlignmentRight; _rightLabel.text = @"Download: 1 Million"; diff --git a/keyBoard/Class/Me/V/MySkinCell.m b/keyBoard/Class/Me/V/MySkinCell.m index 2ef29f2..3581f74 100644 --- a/keyBoard/Class/Me/V/MySkinCell.m +++ b/keyBoard/Class/Me/V/MySkinCell.m @@ -61,7 +61,7 @@ - (void)applySelected:(BOOL)selected { self.selectedState = selected; - UIColor *fill = selected ? [UIColor colorWithHex:KBColor] : [UIColor colorWithWhite:0 alpha:0.51]; + UIColor *fill = selected ? [UIColor colorWithHex:KBColorValue] : [UIColor colorWithWhite:0 alpha:0.51]; _circleLayer.fillColor = fill.CGColor; // 选中改为 #02BEAC _checkLayer.hidden = !selected; // 选中显示白对勾 } diff --git a/keyBoard/Class/Me/VC/MySkinVC.m b/keyBoard/Class/Me/VC/MySkinVC.m index d65b0ee..7831c5c 100644 --- a/keyBoard/Class/Me/VC/MySkinVC.m +++ b/keyBoard/Class/Me/VC/MySkinVC.m @@ -155,9 +155,9 @@ static NSString * const kMySkinCellId = @"kMySkinCellId"; BOOL enable = count > 0; self.deleteButton.enabled = enable; if (enable) { - self.deleteButton.backgroundColor = [UIColor colorWithHex:KBColor]; + self.deleteButton.backgroundColor = [UIColor colorWithHex:KBColorValue]; [self.deleteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - self.deleteButton.layer.borderColor = [UIColor colorWithHex:KBColor].CGColor; + self.deleteButton.layer.borderColor = [UIColor colorWithHex:KBColorValue].CGColor; } else { self.deleteButton.backgroundColor = [UIColor colorWithHex:0xF2F2F2]; [self.deleteButton setTitleColor:[UIColor colorWithHex:0xC8C8C8] forState:UIControlStateNormal]; diff --git a/keyBoard/Class/Shop/VC/KBShopVC.m b/keyBoard/Class/Shop/VC/KBShopVC.m index 2f04dc2..326983e 100644 --- a/keyBoard/Class/Shop/VC/KBShopVC.m +++ b/keyBoard/Class/Shop/VC/KBShopVC.m @@ -90,7 +90,7 @@ static const CGFloat JXheightForHeaderInSection = 50; backgroundView.indicatorHeight = 30; backgroundView.indicatorCornerRadius = JXCategoryViewAutomaticDimension; backgroundView.indicatorColor = [UIColor whiteColor]; // keep selected fill white - backgroundView.layer.borderColor = [UIColor colorWithHex:KBColor].CGColor; + backgroundView.layer.borderColor = [UIColor colorWithHex:KBColorValue].CGColor; backgroundView.layer.borderWidth = 1; backgroundView.indicatorWidthIncrement = 0; // 指示器宽度不额外加宽 // 点击切换时不需要左右滚动动画,直接跳转到目标位置 diff --git a/keyBoard/KeyBoardPrefixHeader.pch b/keyBoard/KeyBoardPrefixHeader.pch index 974e97e..c6406a1 100644 --- a/keyBoard/KeyBoardPrefixHeader.pch +++ b/keyBoard/KeyBoardPrefixHeader.pch @@ -58,7 +58,7 @@ #define COLOR_WITH_RGB(R,G,B,A) [UIColor colorWithRed:R green:G blue:B alpha:A] -#define KBColor 0x02BEAC +#define KBColorValue 0x02BEAC // 当前 KeyWindow(iOS 13 场景化兼容) static inline UIWindow *KB_KeyWindow(void) {