Files
keyboard/keyBoard/Class/Pay/V/KBSvipBenefitCell.m

104 lines
3.2 KiB
Mathematica
Raw Normal View History

2026-02-04 12:48:18 +08:00
//
// KBSvipBenefitCell.m
// keyBoard
//
// SVIP + +
//
#import "KBSvipBenefitCell.h"
@interface KBSvipBenefitCell ()
2026-02-04 14:59:02 +08:00
@property (nonatomic, strong) UIView *coverView; //
2026-02-04 12:48:18 +08:00
@property (nonatomic, strong) UIImageView *iconView; //
@property (nonatomic, strong) UILabel *titleLabel; //
@property (nonatomic, strong) UIImageView *checkView; //
@end
@implementation KBSvipBenefitCell
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.contentView.backgroundColor = [UIColor clearColor];
2026-02-04 14:59:02 +08:00
[self.contentView addSubview:self.coverView];
2026-02-04 12:48:18 +08:00
[self.contentView addSubview:self.iconView];
2026-02-04 14:59:02 +08:00
[self.coverView addSubview:self.titleLabel];
[self.coverView addSubview:self.checkView];
2026-02-04 12:48:18 +08:00
2026-02-04 14:59:02 +08:00
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView).inset(8);
2026-02-04 12:48:18 +08:00
make.centerY.equalTo(self.contentView);
2026-02-04 14:59:02 +08:00
make.height.mas_equalTo(46);
}];
[self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.coverView).offset(16);
make.top.equalTo(self.contentView);
make.width.height.mas_equalTo(38);
2026-02-04 12:48:18 +08:00
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.iconView.mas_right).offset(12);
2026-02-04 14:59:02 +08:00
make.centerY.equalTo(self.coverView);
2026-02-04 12:48:18 +08:00
make.right.lessThanOrEqualTo(self.checkView.mas_left).offset(-12);
}];
[self.checkView mas_makeConstraints:^(MASConstraintMaker *make) {
2026-02-04 14:59:02 +08:00
make.right.equalTo(self.coverView).offset(-16);
make.centerY.equalTo(self.coverView);
2026-02-04 12:48:18 +08:00
make.width.height.mas_equalTo(20);
}];
}
return self;
}
- (void)configWithIcon:(NSString *)iconName title:(NSString *)title {
if (iconName.length) {
self.iconView.image = [UIImage imageNamed:iconName];
}
self.titleLabel.text = title.length ? title : @"";
}
#pragma mark - Lazy
- (UIImageView *)iconView {
if (!_iconView) {
_iconView = [UIImageView new];
_iconView.contentMode = UIViewContentModeScaleAspectFit;
_iconView.layer.cornerRadius = 8;
_iconView.clipsToBounds = YES;
}
return _iconView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [UILabel new];
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_titleLabel.font = [KBFont regular:14];
}
return _titleLabel;
}
- (UIImageView *)checkView {
if (!_checkView) {
_checkView = [UIImageView new];
_checkView.contentMode = UIViewContentModeScaleAspectFit;
2026-02-04 14:59:02 +08:00
_checkView.image = [UIImage imageNamed:@"pay_oks_icon"];
2026-02-04 12:48:18 +08:00
}
return _checkView;
}
2026-02-04 14:59:02 +08:00
- (UIView *)coverView{
if (!_coverView) {
_coverView = [[UIView alloc] init];
_coverView.backgroundColor = [UIColor whiteColor];
_coverView.layer.cornerRadius = 8;
_coverView.layer.masksToBounds = true;
}
return _coverView;
}
2026-02-04 12:48:18 +08:00
@end