This commit is contained in:
2025-11-07 20:58:14 +08:00
parent 91d754b389
commit 48a12f0919
30 changed files with 282 additions and 46 deletions

View File

@@ -11,6 +11,8 @@
@interface HomeHeadView()
@property (nonatomic, strong) UIImageView *loveKeyImageView;
//
@property (nonatomic, strong) UIImageView *vipImageView;
// /
@@ -43,6 +45,7 @@
#pragma mark - UI
- (void)setupViews {
// [self addSubview:self.loveKeyImageView];
[self addSubview:self.vipImageView];
[self addSubview:self.titleLabel];
[self addSubview:self.subTitleLabel];
@@ -58,6 +61,13 @@
make.width.mas_equalTo(217);
make.height.mas_equalTo(166);
}];
// [self.loveKeyImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(self.vipImageView.mas_centerY).offset(0);
// make.right.equalTo(self).offset(-16);
// make.width.mas_equalTo(335);
// make.height.mas_equalTo(117);
// }];
//
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -82,7 +92,7 @@
make.top.equalTo(self.subTitleLabel.mas_bottom).offset(16);
make.left.equalTo(self.mas_left).offset(16);
make.right.equalTo(self.mas_right).offset(-16);
make.height.mas_equalTo(94);
make.height.mas_equalTo(80);
}];
//
@@ -128,7 +138,11 @@
@"Personalized\nKeyboard",
@"Chat\nPersona",
@"Emotional\nCounseling"];
[self configureFeatureTitles:titles images:nil];
NSArray *images = @[[UIImage imageNamed:@"home_ai_icon"],
[UIImage imageNamed:@"home_keyboard_icon"],
[UIImage imageNamed:@"home_chat_icon"],
[UIImage imageNamed:@"home_emotion_icon"]];
[self configureFeatureTitles:titles images:images];
}
#pragma mark - Public
@@ -141,21 +155,6 @@
btn.textLabel.text = titles[i];
}
UIImage *img = (i < images.count) ? images[i] : nil;
if (!img) {
//
CGSize s = btn.iconSize;
CGFloat cr = MIN(s.width, s.height) * 0.26;
UIColor *c1 = [UIColor colorWithHex:0xC9F7E9];
UIColor *c2 = [UIColor colorWithHex:0xA6E6FF];
if (i == 1) { c1 = [UIColor colorWithHex:0xD7E5FF]; c2 = [UIColor colorWithHex:0xBFD2FF]; }
if (i == 2) { c1 = [UIColor colorWithHex:0xEBD8FF]; c2 = [UIColor colorWithHex:0xDDBBFF]; }
if (i == 3) { c1 = [UIColor colorWithHex:0xD1F5DE]; c2 = [UIColor colorWithHex:0xB6EBCE]; }
img = [UIImage kb_gradientImageWithColors:@[c1, c2]
locations:nil
size:s
direction:KBGradientDirectionLeftTopToRightBottom
cornerRadius:cr];
}
btn.iconView.image = img;
}
}
@@ -169,12 +168,19 @@
- (UIImageView *)vipImageView{
if (!_vipImageView) {
_vipImageView = [[UIImageView alloc] init];
_vipImageView.image = [UIImage imageNamed:@"home_vip_card"];
_vipImageView.image = [UIImage imageNamed:@"home_topvip_icon"];
_vipImageView.contentMode = UIViewContentModeScaleAspectFit;
_vipImageView.backgroundColor = [UIColor redColor];
}
return _vipImageView;
}
- (UIImageView *)loveKeyImageView{
if (!_loveKeyImageView) {
_loveKeyImageView = [[UIImageView alloc] init];
_loveKeyImageView.image = [UIImage imageNamed:@"hoem_love_key"];
_loveKeyImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _loveKeyImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
@@ -206,8 +212,8 @@
NSMutableArray *arr = [NSMutableArray arrayWithCapacity:4];
for (int i = 0; i < 4; i++) {
KBTopImageButton *btn = [[KBTopImageButton alloc] init];
btn.iconSize = CGSizeMake(46, 46);
btn.spacing = 5;
btn.iconSize = CGSizeMake(54, 44);
btn.spacing = 0;
[self.featuresContainer addSubview:btn];
[arr addObject:btn];
}

View File

@@ -39,14 +39,14 @@
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.rankLabel.mas_right).offset(12);
make.centerY.equalTo(self.contentView);
make.width.height.mas_equalTo(52);
make.width.height.mas_equalTo(56);
}];
[self.actionButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.contentView).offset(-16);
make.width.mas_equalTo(64);
make.height.mas_equalTo(36);
make.width.mas_equalTo(56);
make.height.mas_equalTo(38);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -104,8 +104,8 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
_titleLabel.textColor = [UIColor colorWithWhite:0.1 alpha:1];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
}
return _titleLabel;
}
@@ -113,9 +113,9 @@
- (UILabel *)subLabel {
if (!_subLabel) {
_subLabel = [[UILabel alloc] init];
_subLabel.font = [UIFont systemFontOfSize:13];
_subLabel.textColor = [UIColor colorWithWhite:0.5 alpha:1];
_subLabel.numberOfLines = 1;
_subLabel.font = [UIFont systemFontOfSize:12];
_subLabel.textColor = [UIColor colorWithHex:0x9A9A9A];
_subLabel.numberOfLines = 2;
}
return _subLabel;
}
@@ -123,7 +123,7 @@
- (UIButton *)actionButton {
if (!_actionButton) {
_actionButton = [UIButton buttonWithType:UIButtonTypeCustom];
_actionButton.layer.cornerRadius = 18;
_actionButton.layer.cornerRadius = 12;
_actionButton.layer.masksToBounds = YES;
_actionButton.titleLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightBold];
}

View File

@@ -45,7 +45,8 @@
// HWPanModal _contentView
// Pods/HWPanModal/Sources/View/PanModal/HWPanModalContainerView.m: adjustPanContainerBackgroundColor
// _contentView
self.backgroundColor = [UIColor colorWithHex:0xE8FFF4]; // 绿
// self.backgroundColor = [UIColor colorWithHex:0xE8FFF4]; // 绿
self.backgroundColor = [UIColor clearColor];
// HWBackgroundConfig *config = [HWBackgroundConfig configWithBehavior:HWBackgroundBehaviorDefault];
// config.backgroundAlpha = 0;
// [self.hw_dimmedView reloadConfig:config];
@@ -180,11 +181,11 @@
[self.leftBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(self.secWhiteContentView);
make.bottom.equalTo(self.secWhiteContentView);
// make.bottom.equalTo(self.secWhiteContentView);
}];
[self.rightBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(self.secWhiteContentView);
make.bottom.equalTo(self.secWhiteContentView);
// make.bottom.equalTo(self.secWhiteContentView);
}];
@@ -231,7 +232,7 @@
[self.topBar addSubview:self.underlineImageView];
// Masonry
CGFloat topPadding = 0; //
CGFloat topPadding = 12; //
[self.topBar mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.secWhiteContentView);
make.top.equalTo(self.secWhiteContentView).offset(topPadding);
@@ -259,14 +260,14 @@
[self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.topBar.mas_bottom).offset(8);
make.left.right.equalTo(self.secWhiteContentView).inset(16);
make.left.right.equalTo(self.secWhiteContentView).inset(20);
make.bottom.equalTo(self.secWhiteContentView);
}];
[self.personImageView mas_makeConstraints:^(MASConstraintMaker *make) {
//
make.left.equalTo(self).offset(46);
make.bottom.equalTo(self.topBar.mas_top).offset(20);
make.bottom.equalTo(self.topBar.mas_top).offset(11);
make.width.mas_equalTo(53);
make.height.mas_equalTo(81);
}];
@@ -283,7 +284,7 @@
#pragma mark - Action
- (void)onTapTopButton:(UIButton *)sender {
[self switchToIndex:sender.tag animated:YES];
[self switchToIndex:sender.tag animated:false];
// [self hw_panModalSetNeedsLayoutUpdate];
}
@@ -318,7 +319,6 @@
//
// [self addChildViewController:target];
[self.containerView addSubview:target.view];
target.view.backgroundColor = [UIColor colorWithWhite:0.98 alpha:1];
[target.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.right.equalTo(self.containerView);
make.bottom.equalTo(self.containerView).offset(-KB_TABBAR_HEIGHT);

View File

@@ -43,7 +43,7 @@
[self.cardImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.avatarCircleView.mas_bottom).offset(-34); //
make.left.right.equalTo(self);
make.height.mas_equalTo(KBFit(148));
make.height.mas_equalTo(KBFit(158));
}];
@@ -129,6 +129,9 @@
@property (nonatomic, strong) KBTopThreeCardView *rightCard;
/// KBTopThreeView
@property (nonatomic, strong) UIButton *plusButton;
/// plus
@property (nonatomic, strong) UIButton *leftPlusButton;
@property (nonatomic, strong) UIButton *rightPlusButton;
@end
@implementation KBTopThreeView
@@ -146,6 +149,8 @@
[self addSubview:self.centerCard];
[self addSubview:self.rightCard];
[self addSubview:self.plusButton];
[self addSubview:self.leftPlusButton];
[self addSubview:self.rightPlusButton];
//
[self.centerCard mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -173,11 +178,25 @@
// plusButton
[self.plusButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.centerCard.mas_bottom).offset(12);
make.centerX.equalTo(self);
make.width.mas_equalTo(52);
make.centerX.equalTo(self); // equalTo(self.centerCard)
make.width.mas_equalTo(60);
make.height.mas_equalTo(28);
make.bottom.equalTo(self).offset(-8);
}];
// plus
[self.leftPlusButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.leftCard.mas_bottom).offset(12);
make.centerX.equalTo(self.leftCard);
make.width.height.equalTo(self.plusButton);
make.bottom.equalTo(self).offset(-8);
}];
[self.rightPlusButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.rightCard.mas_bottom).offset(12);
make.centerX.equalTo(self.rightCard);
make.width.height.equalTo(self.plusButton);
make.bottom.equalTo(self).offset(-8);
}];
}
- (void)configWithItems:(NSArray<NSDictionary *> *)items {
@@ -214,4 +233,30 @@
return _plusButton;
}
- (UIButton *)leftPlusButton {
if (!_leftPlusButton) {
_leftPlusButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_leftPlusButton setTitle:@"+" forState:UIControlStateNormal];
[_leftPlusButton setTitleColor:[UIColor colorWithRed:0.20 green:0.65 blue:0.50 alpha:1.0] forState:UIControlStateNormal];
_leftPlusButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
_leftPlusButton.layer.cornerRadius = 14.0;
_leftPlusButton.layer.masksToBounds = YES;
_leftPlusButton.backgroundColor = [[UIColor colorWithRed:0.20 green:0.65 blue:0.50 alpha:1.0] colorWithAlphaComponent:0.15];
}
return _leftPlusButton;
}
- (UIButton *)rightPlusButton {
if (!_rightPlusButton) {
_rightPlusButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_rightPlusButton setTitle:@"+" forState:UIControlStateNormal];
[_rightPlusButton setTitleColor:[UIColor colorWithRed:0.20 green:0.65 blue:0.50 alpha:1.0] forState:UIControlStateNormal];
_rightPlusButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
_rightPlusButton.layer.cornerRadius = 14.0;
_rightPlusButton.layer.masksToBounds = YES;
_rightPlusButton.backgroundColor = [[UIColor colorWithRed:0.20 green:0.65 blue:0.50 alpha:1.0] colorWithAlphaComponent:0.15];
}
return _rightPlusButton;
}
@end