处理svip

This commit is contained in:
2026-02-04 12:48:18 +08:00
parent 68a610e0a8
commit b4e4b7b606
10 changed files with 817 additions and 10 deletions

View File

@@ -0,0 +1,88 @@
//
// KBSvipBenefitCell.m
// keyBoard
//
// SVIP + +
//
#import "KBSvipBenefitCell.h"
@interface KBSvipBenefitCell ()
@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];
[self.contentView addSubview:self.iconView];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.checkView];
[self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(16);
make.centerY.equalTo(self.contentView);
make.width.height.mas_equalTo(40);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.iconView.mas_right).offset(12);
make.centerY.equalTo(self.contentView);
make.right.lessThanOrEqualTo(self.checkView.mas_left).offset(-12);
}];
[self.checkView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView).offset(-16);
make.centerY.equalTo(self.contentView);
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;
// 使 SF Symbol
if (@available(iOS 13.0, *)) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithWeight:UIImageSymbolWeightMedium];
_checkView.image = [UIImage systemImageNamed:@"checkmark" withConfiguration:config];
}
_checkView.tintColor = [UIColor colorWithHex:KBColorValue];
}
return _checkView;
}
@end