This commit is contained in:
2025-11-14 23:09:04 +08:00
parent dace0a9309
commit 1f9dbba39d
20 changed files with 183 additions and 63 deletions

View File

@@ -12,6 +12,10 @@
@property (nonatomic, strong) UIView *containerView;
// pay_vip_icon
@property (nonatomic, strong) UIImageView *vipImageView;
@property (nonatomic, strong) UIImageView *wanImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *desLabel;
//
@property (nonatomic, strong) UIImageView *aiImageView;
@property (nonatomic, strong) UIImageView *keyboardImageView;
@@ -33,11 +37,28 @@
// 1.
[self.containerView addSubview:self.vipImageView];
[self.vipImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.containerView).offset(16);
make.right.equalTo(self.containerView).offset(-16);
make.top.equalTo(self.containerView).offset(KB_NAV_TOTAL_HEIGHT + 8);
make.height.mas_equalTo(KBFit(180));
make.right.left.equalTo(self.containerView).inset(KBFit(27));
make.top.equalTo(self.containerView).offset(KB_NAV_TOTAL_HEIGHT + 10);
make.height.mas_equalTo((269));
}];
[self.containerView addSubview:self.wanImageView];
[self.wanImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.left.equalTo(self.containerView);
make.top.equalTo(self.vipImageView).offset(70);
make.bottom.equalTo(self.containerView);
}];
[self.containerView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.containerView);
make.top.equalTo(self.wanImageView).offset(53);
}];
[self.containerView addSubview:self.desLabel];
[self.desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.containerView);
make.top.equalTo(self.titleLabel.mas_bottom).offset(10);
}];
// 2.
UIView *g1 = [self gridItemWithImageView:self.aiImageView];
@@ -49,11 +70,11 @@
[self.containerView addSubview:g3];
[self.containerView addSubview:g4];
CGFloat spacing = 12;
CGFloat spacing = 16;
[g1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.vipImageView);
make.top.equalTo(self.vipImageView.mas_bottom).offset(18);
make.height.mas_equalTo(KBFit(90));
make.top.equalTo(self.desLabel.mas_bottom).offset(18);
make.height.mas_equalTo(((113)));
}];
[g2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.vipImageView);
@@ -74,7 +95,7 @@
make.left.equalTo(g3.mas_right).offset(spacing);
make.height.equalTo(g1);
make.width.equalTo(g1);
make.bottom.lessThanOrEqualTo(self.containerView).offset(-12);
// make.bottom.lessThanOrEqualTo(self.containerView).offset(-12);
}];
}
return self;
@@ -84,13 +105,15 @@
- (UIView *)gridItemWithImageView:(UIImageView *)iv {
//
UIView *v = [UIView new];
v.backgroundColor = [UIColor colorWithWhite:0.97 alpha:1.0];
v.layer.cornerRadius = 12;
v.layer.masksToBounds = YES;
// v.backgroundColor = [UIColor colorWithWhite:0.97 alpha:1.0];
// v.layer.cornerRadius = 12;
// v.layer.masksToBounds = YES;
[v addSubview:iv];
iv.contentMode = UIViewContentModeScaleAspectFill;
[iv mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(v);
make.width.height.mas_equalTo(40);
// make.center.equalTo(v);
// make.width.height.mas_equalTo(40);
make.edges.equalTo(v);
}];
return v;
}
@@ -108,12 +131,18 @@
if (!_vipImageView) {
_vipImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pay_vip_icon"]];
_vipImageView.contentMode = UIViewContentModeScaleAspectFill;
_vipImageView.clipsToBounds = YES;
_vipImageView.layer.cornerRadius = 14;
}
return _vipImageView;
}
- (UIImageView *)wanImageView {
if (!_wanImageView) {
_wanImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pay_wanwhite_icon"]];
_wanImageView.contentMode = UIViewContentModeScaleAspectFill;
}
return _wanImageView;
}
- (UIImageView *)aiImageView {
if (!_aiImageView) {
_aiImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pay_ai_icon"]];
@@ -143,5 +172,25 @@
return _emotionImageView;
}
- (UILabel *)titleLabel{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"Become a member of LOVE KEY";
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_titleLabel.font = [UIFont systemFontOfSize:25 weight:UIFontWeightBold];
}
return _titleLabel;
}
- (UILabel *)desLabel{
if (!_desLabel) {
_desLabel = [[UILabel alloc] init];
_desLabel.text = @"Unlock all functions";
_desLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_desLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold];
}
return _desLabel;
}
@end

View File

@@ -13,7 +13,6 @@
@property (nonatomic, strong) UILabel *priceLabel; // $4.49
@property (nonatomic, strong) UILabel *strikeLabel; // 线
@property (nonatomic, strong) UIButton *selectButton; //
@property (nonatomic, strong) CAShapeLayer *borderLayer; //
@end
@implementation KBVipSubscribeCell
@@ -23,8 +22,12 @@
self.contentView.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.cardView];
// self.cardView.backgroundColor = [UIColor redColor];
[self.cardView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView);
make.left.right.equalTo(self.contentView);
make.top.equalTo(self.contentView).inset(6);
make.bottom.equalTo(self.contentView);
}];
[self.cardView addSubview:self.titleLabel];
@@ -34,7 +37,7 @@
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.cardView).offset(16);
make.top.equalTo(self.cardView).offset(16);
make.top.equalTo(self.cardView).offset(11);
}];
[self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel);
@@ -49,27 +52,16 @@
make.right.equalTo(self.cardView).offset(-16);
make.width.height.mas_equalTo(28);
}];
// 绿
self.borderLayer = [CAShapeLayer layer];
self.borderLayer.strokeColor = [UIColor colorWithWhite:0.9 alpha:1.0].CGColor;
// 使
self.borderLayer.fillColor = UIColor.clearColor.CGColor;
self.borderLayer.lineWidth = 1.5;
// label/button
[self.cardView.layer insertSublayer:self.borderLayer atIndex:0];
// CALayer borderLayer
self.cardView.layer.borderWidth = 1;
self.cardView.layer.borderColor = [UIColor colorWithWhite:0.9 alpha:1.0].CGColor;
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
CGFloat radius = 16;
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.cardView.bounds cornerRadius:radius];
self.cardView.layer.cornerRadius = radius;
self.cardView.layer.masksToBounds = YES;
self.borderLayer.frame = self.cardView.bounds;
self.borderLayer.path = path.CGPath;
}
- (void)prepareForReuse {
@@ -101,17 +93,13 @@
[self.selectButton setImage:img forState:UIControlStateNormal];
CGColorRef color = (selected ? [UIColor colorWithHex:KBColorValue].CGColor : [UIColor colorWithWhite:0.9 alpha:1.0].CGColor);
void (^changes)(void) = ^{
self.borderLayer.strokeColor = color;
self.cardView.layer.shadowOpacity = selected ? 0.12 : 0.0;
self.cardView.layer.shadowColor = [UIColor colorWithHex:KBColorValue].CGColor;
self.cardView.layer.shadowRadius = selected ? 8 : 0;
self.cardView.layer.shadowOffset = CGSizeMake(0, selected ? 4 : 0);
self.cardView.layer.borderColor = color;
// self.cardView.layer.shadowOpacity = selected ? 0.12 : 0.0;
// self.cardView.layer.shadowColor = [UIColor colorWithHex:KBColorValue].CGColor;
// self.cardView.layer.shadowRadius = selected ? 8 : 0;
// self.cardView.layer.shadowOffset = CGSizeMake(0, selected ? 4 : 0);
};
if (animated) {
[UIView animateWithDuration:0.15 animations:changes];
} else {
changes();
}
}
#pragma mark - Lazy
@@ -119,6 +107,9 @@
if (!_cardView) {
_cardView = [UIView new];
_cardView.backgroundColor = [UIColor whiteColor];
CGFloat radius = 10;
_cardView.layer.cornerRadius = radius;
_cardView.clipsToBounds = YES;
}
return _cardView;
}
@@ -127,7 +118,7 @@
_titleLabel = [UILabel new];
_titleLabel.text = @"Monthly Subscription";
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightSemibold];
}
return _titleLabel;
}
@@ -136,7 +127,7 @@
_priceLabel = [UILabel new];
_priceLabel.text = @"$4.49";
_priceLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_priceLabel.font = [UIFont systemFontOfSize:28 weight:UIFontWeightBold];
_priceLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightBold];
}
return _priceLabel;
}
@@ -144,7 +135,7 @@
if (!_strikeLabel) {
_strikeLabel = [UILabel new];
_strikeLabel.text = @"$4.49";
_strikeLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_strikeLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
_strikeLabel.textColor = [UIColor colorWithWhite:0.7 alpha:1.0];
}
return _strikeLabel;