This commit is contained in:
2026-02-04 15:20:53 +08:00
parent faae0297cb
commit 7c7e2477cb
8 changed files with 67 additions and 30 deletions

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "pay_colorbg_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "pay_colorbg_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "pay_graybg_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "pay_graybg_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -2,13 +2,13 @@
// KBSvipSubscribeCell.m // KBSvipSubscribeCell.m
// keyBoard // keyBoard
// //
// SVIP 绿 // SVIP 使
// //
#import "KBSvipSubscribeCell.h" #import "KBSvipSubscribeCell.h"
@interface KBSvipSubscribeCell () @interface KBSvipSubscribeCell ()
@property (nonatomic, strong) UIView *cardView; // @property (nonatomic, strong) UIImageView *bgImageView; //
@property (nonatomic, strong) UILabel *titleLabel; // "1 Week" / "1 Month" / "1 Year" @property (nonatomic, strong) UILabel *titleLabel; // "1 Week" / "1 Month" / "1 Year"
@property (nonatomic, strong) UILabel *priceLabel; // "$6.90" @property (nonatomic, strong) UILabel *priceLabel; // "$6.90"
@property (nonatomic, strong) UILabel *strikeLabel; // 线 @property (nonatomic, strong) UILabel *strikeLabel; // 线
@@ -20,31 +20,27 @@
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:frame]) {
self.contentView.backgroundColor = [UIColor clearColor]; self.contentView.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.cardView]; [self.contentView addSubview:self.bgImageView];
[self.cardView mas_makeConstraints:^(MASConstraintMaker *make) { [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView); make.edges.equalTo(self.contentView);
}]; }];
[self.cardView addSubview:self.titleLabel]; [self.contentView addSubview:self.titleLabel];
[self.cardView addSubview:self.priceLabel]; [self.contentView addSubview:self.priceLabel];
[self.cardView addSubview:self.strikeLabel]; [self.contentView addSubview:self.strikeLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.cardView); make.centerX.equalTo(self.contentView);
make.top.equalTo(self.cardView).offset(12); make.top.equalTo(self.contentView).offset(12);
}]; }];
[self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.cardView); make.centerX.equalTo(self.contentView);
make.top.equalTo(self.titleLabel.mas_bottom).offset(8); make.top.equalTo(self.titleLabel.mas_bottom).offset(8);
}]; }];
[self.strikeLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.strikeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.cardView); make.centerX.equalTo(self.contentView);
make.top.equalTo(self.priceLabel.mas_bottom).offset(4); make.top.equalTo(self.priceLabel.mas_bottom).offset(4);
}]; }];
// CALayer
self.cardView.layer.borderWidth = 1.5;
self.cardView.layer.borderColor = [UIColor colorWithWhite:0.9 alpha:1.0].CGColor;
} }
return self; return self;
} }
@@ -73,28 +69,26 @@
} }
- (void)applySelected:(BOOL)selected animated:(BOOL)animated { - (void)applySelected:(BOOL)selected animated:(BOOL)animated {
CGColorRef color = (selected ? [UIColor colorWithHex:KBColorValue].CGColor : [UIColor colorWithWhite:0.9 alpha:1.0].CGColor); NSString *imageName = selected ? @"pay_colorbg_icon" : @"pay_graybg_icon";
UIColor *bgColor = selected ? [UIColor colorWithHex:0xE8FFF6] : [UIColor whiteColor];
void (^changes)(void) = ^{ void (^changes)(void) = ^{
self.cardView.layer.borderColor = color; self.bgImageView.image = [UIImage imageNamed:imageName];
self.cardView.backgroundColor = bgColor;
}; };
if (animated) { if (animated) {
[UIView animateWithDuration:0.2 animations:changes]; [UIView transitionWithView:self.bgImageView duration:0.2 options:UIViewAnimationOptionTransitionCrossDissolve animations:changes completion:nil];
} else { } else {
changes(); changes();
} }
} }
#pragma mark - Lazy #pragma mark - Lazy
- (UIView *)cardView {
if (!_cardView) { - (UIImageView *)bgImageView {
_cardView = [UIView new]; if (!_bgImageView) {
_cardView.backgroundColor = [UIColor whiteColor]; _bgImageView = [UIImageView new];
_cardView.layer.cornerRadius = 12; _bgImageView.contentMode = UIViewContentModeScaleAspectFill;
_cardView.clipsToBounds = YES; _bgImageView.image = [UIImage imageNamed:@"pay_graybg_icon"];
} }
return _cardView; return _bgImageView;
} }
- (UILabel *)titleLabel { - (UILabel *)titleLabel {

View File

@@ -334,9 +334,8 @@ static NSString * const kKBSvipBenefitHeaderId = @"kKBSvipBenefitHeaderId";
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGFloat screenW = KB_SCREEN_WIDTH; CGFloat screenW = KB_SCREEN_WIDTH;
if (indexPath.section == 0) { if (indexPath.section == 0) {
// // 105 * 124
CGFloat itemW = (screenW - 32 - 20) / 3.0; // 1610*2 return CGSizeMake(105, 124);
return CGSizeMake(itemW, 90);
} else { } else {
// //
return CGSizeMake(screenW - 32, 56); return CGSizeMake(screenW - 32, 56);