2025-11-08 22:25:57 +08:00
|
|
|
|
//
|
|
|
|
|
|
// KBSkinDetailHeaderCell.m
|
|
|
|
|
|
// keyBoard
|
|
|
|
|
|
//
|
|
|
|
|
|
// Created by Mac on 2025/11/8.
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import "KBSkinDetailHeaderCell.h"
|
2025-12-11 15:39:33 +08:00
|
|
|
|
#import "UIImageView+KBWebImage.h"
|
|
|
|
|
|
#import "KBShopThemeDetailModel.h"
|
2025-11-08 22:25:57 +08:00
|
|
|
|
|
|
|
|
|
|
@implementation KBSkinDetailHeaderCell
|
|
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
|
|
|
if (self = [super initWithFrame:frame]) {
|
|
|
|
|
|
self.contentView.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
|
self.contentView.layer.cornerRadius = 12;
|
|
|
|
|
|
self.contentView.layer.masksToBounds = YES;
|
|
|
|
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.coverView];
|
|
|
|
|
|
[self.contentView addSubview:self.leftLabel];
|
|
|
|
|
|
[self.contentView addSubview:self.rightLabel];
|
|
|
|
|
|
|
|
|
|
|
|
// 上图,16:9 比例;下方左右文案
|
|
|
|
|
|
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
|
make.left.top.right.equalTo(self.contentView);
|
|
|
|
|
|
// 高度按照宽度等比(接近截图比例)
|
2025-11-17 15:39:03 +08:00
|
|
|
|
// make.height.equalTo(self.contentView.mas_width).multipliedBy(0.58);
|
|
|
|
|
|
make.height.mas_equalTo(KBFit(264));
|
2025-11-08 22:25:57 +08:00
|
|
|
|
}];
|
|
|
|
|
|
[self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
2025-11-17 15:39:03 +08:00
|
|
|
|
make.left.equalTo(self.contentView).offset(0);
|
2025-11-08 22:25:57 +08:00
|
|
|
|
make.top.equalTo(self.coverView.mas_bottom).offset(10);
|
|
|
|
|
|
}];
|
|
|
|
|
|
[self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
|
make.right.equalTo(self.contentView).offset(-12);
|
|
|
|
|
|
make.centerY.equalTo(self.leftLabel);
|
|
|
|
|
|
}];
|
|
|
|
|
|
}
|
|
|
|
|
|
return self;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-11 15:39:33 +08:00
|
|
|
|
- (void)configWithDetail:(KBShopThemeDetailModel *)detail {
|
|
|
|
|
|
NSString *title = detail.themeName.length ? detail.themeName : @"Dopamine";
|
|
|
|
|
|
NSString *download = detail.themeDownload.length ? detail.themeDownload : @"0";
|
|
|
|
|
|
NSString *downloadText = [NSString stringWithFormat:@"%@: %@", KBLocalized(@"Download"), download];
|
|
|
|
|
|
self.leftLabel.text = title;
|
|
|
|
|
|
self.rightLabel.text = downloadText;
|
2025-12-11 19:43:55 +08:00
|
|
|
|
// UIImage *placeholder = [UIImage imageNamed:@"shop_headbigBg_icon"];
|
|
|
|
|
|
// if (detail.themePreviewImageUrl.length) {
|
|
|
|
|
|
[self.coverView kb_setImageURL:detail.themePreviewImageUrl placeholder:KBPlaceholderImage];
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// self.coverView.image = placeholder;
|
|
|
|
|
|
// }
|
2025-11-08 22:25:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Lazy
|
|
|
|
|
|
- (UIImageView *)coverView {
|
|
|
|
|
|
if (!_coverView) {
|
|
|
|
|
|
_coverView = [[UIImageView alloc] init];
|
|
|
|
|
|
_coverView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
|
|
|
_coverView.clipsToBounds = YES;
|
2025-12-11 15:39:33 +08:00
|
|
|
|
_coverView.layer.cornerRadius = 12;
|
2025-11-08 22:25:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
return _coverView;
|
|
|
|
|
|
}
|
|
|
|
|
|
- (UILabel *)leftLabel {
|
|
|
|
|
|
if (!_leftLabel) {
|
|
|
|
|
|
_leftLabel = [UILabel new];
|
2025-11-25 15:36:16 +08:00
|
|
|
|
_leftLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
|
|
|
|
|
_leftLabel.font = [KBFont medium:16];
|
2025-11-08 22:25:57 +08:00
|
|
|
|
_leftLabel.text = @"Dopamine";
|
|
|
|
|
|
}
|
|
|
|
|
|
return _leftLabel;
|
|
|
|
|
|
}
|
|
|
|
|
|
- (UILabel *)rightLabel {
|
|
|
|
|
|
if (!_rightLabel) {
|
|
|
|
|
|
_rightLabel = [UILabel new];
|
2025-11-10 19:51:23 +08:00
|
|
|
|
_rightLabel.textColor = [UIColor colorWithHex:KBColorValue];
|
2025-11-25 15:36:16 +08:00
|
|
|
|
_rightLabel.font = [KBFont regular:13];
|
2025-11-08 22:25:57 +08:00
|
|
|
|
_rightLabel.textAlignment = NSTextAlignmentRight;
|
|
|
|
|
|
_rightLabel.text = @"Download: 1 Million";
|
|
|
|
|
|
}
|
|
|
|
|
|
return _rightLabel;
|
|
|
|
|
|
}
|
|
|
|
|
|
@end
|