Files
keyboard/keyBoard/Class/Me/V/KBSkinDetailHeaderCell.m

76 lines
2.6 KiB
Mathematica
Raw Normal View History

2025-11-08 22:25:57 +08:00
//
// KBSkinDetailHeaderCell.m
// keyBoard
//
// Created by Mac on 2025/11/8.
//
#import "KBSkinDetailHeaderCell.h"
@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);
//
make.height.equalTo(self.contentView.mas_width).multipliedBy(0.58);
}];
[self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(12);
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;
}
- (void)configWithTitle:(NSString *)title right:(NSString *)right {
// /
self.leftLabel.text = title.length ? title : @"Dopamine";
self.rightLabel.text = right.length ? right : @"Download: 1 Million";
//
self.coverView.backgroundColor = [UIColor colorWithWhite:0.94 alpha:1.0];
}
#pragma mark - Lazy
- (UIImageView *)coverView {
if (!_coverView) {
_coverView = [[UIImageView alloc] init];
_coverView.contentMode = UIViewContentModeScaleAspectFill;
_coverView.clipsToBounds = YES;
}
return _coverView;
}
- (UILabel *)leftLabel {
if (!_leftLabel) {
_leftLabel = [UILabel new];
_leftLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
_leftLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
_leftLabel.text = @"Dopamine";
}
return _leftLabel;
}
- (UILabel *)rightLabel {
if (!_rightLabel) {
_rightLabel = [UILabel new];
_rightLabel.textColor = [UIColor colorWithHex:0x02BEAC];
_rightLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
_rightLabel.textAlignment = NSTextAlignmentRight;
_rightLabel.text = @"Download: 1 Million";
}
return _rightLabel;
}
@end