1
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#import "KBSvipBenefitCell.h"
|
||||
|
||||
@interface KBSvipBenefitCell ()
|
||||
@property (nonatomic, strong) UIView *coverView; // 左侧图标
|
||||
|
||||
@property (nonatomic, strong) UIImageView *iconView; // 左侧图标
|
||||
@property (nonatomic, strong) UILabel *titleLabel; // 权益文字
|
||||
@property (nonatomic, strong) UIImageView *checkView; // 右侧勾选
|
||||
@@ -18,26 +20,33 @@
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
|
||||
[self.contentView addSubview:self.coverView];
|
||||
[self.contentView addSubview:self.iconView];
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.contentView addSubview:self.checkView];
|
||||
[self.coverView addSubview:self.titleLabel];
|
||||
[self.coverView addSubview:self.checkView];
|
||||
|
||||
|
||||
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.contentView).inset(8);
|
||||
make.centerY.equalTo(self.contentView);
|
||||
make.height.mas_equalTo(46);
|
||||
}];
|
||||
|
||||
[self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.contentView).offset(16);
|
||||
make.centerY.equalTo(self.contentView);
|
||||
make.width.height.mas_equalTo(40);
|
||||
make.left.equalTo(self.coverView).offset(16);
|
||||
make.top.equalTo(self.contentView);
|
||||
make.width.height.mas_equalTo(38);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.iconView.mas_right).offset(12);
|
||||
make.centerY.equalTo(self.contentView);
|
||||
make.centerY.equalTo(self.coverView);
|
||||
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.right.equalTo(self.coverView).offset(-16);
|
||||
make.centerY.equalTo(self.coverView);
|
||||
make.width.height.mas_equalTo(20);
|
||||
}];
|
||||
}
|
||||
@@ -75,14 +84,20 @@
|
||||
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];
|
||||
_checkView.image = [UIImage imageNamed:@"pay_oks_icon"];
|
||||
}
|
||||
return _checkView;
|
||||
}
|
||||
|
||||
|
||||
- (UIView *)coverView{
|
||||
if (!_coverView) {
|
||||
_coverView = [[UIView alloc] init];
|
||||
_coverView.backgroundColor = [UIColor whiteColor];
|
||||
_coverView.layer.cornerRadius = 8;
|
||||
_coverView.layer.masksToBounds = true;
|
||||
}
|
||||
return _coverView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user