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];
}