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

@@ -19,6 +19,7 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
@property (nonatomic, strong) NSArray<NSDictionary *> *plans; //
@property (nonatomic, assign) NSInteger selectedIndex; //
@property (nonatomic, strong) UIButton *closeButton; //
@property (nonatomic, strong) UIImageView *bgImageView; //
@end
@@ -29,9 +30,15 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
//
// self.kb_titleLabel.text = @"VIP";
// self.kb_navView.backgroundColor = [UIColor clearColor];
self.view.backgroundColor = [UIColor colorWithWhite:0.97 alpha:1.0];
self.view.backgroundColor = [UIColor colorWithHex:0xF6F7FB];
self.kb_enableCustomNavBar = NO;
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pay_vipbg_icon"]];
self.bgImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.view addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.right.equalTo(self.view);
make.height.mas_equalTo(224);
}];
//
self.plans = @[
@{@"title":@"Monthly Subscription", @"price":@"$4.49", @"strike":@"$4.49"},
@@ -39,17 +46,18 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
@{@"title":@"Monthly Subscription", @"price":@"$4.49", @"strike":@"$4.49"},
];
self.selectedIndex = 1; //
[self.view addSubview:self.closeButton];
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT);
make.left.equalTo(self.view).offset(15);
make.width.height.mas_equalTo(36);
}];
//
[self.view addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.view);
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT);
make.top.equalTo(self.view).offset(0);
}];
[self.view addSubview:self.closeButton];
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT - 30);
make.left.equalTo(self.view).offset(15);
make.width.height.mas_equalTo(36);
}];
[self.collectionView reloadData];
@@ -67,6 +75,11 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
if (cell) { [cell applySelected:YES animated:NO]; }
}
#pragma mark - Action
- (void)onTapClose{
[self.navigationController popViewControllerAnimated:true];
}
#pragma mark - UICollectionView DataSource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
@@ -133,7 +146,7 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGFloat w = KB_SCREEN_WIDTH - 32;
if (indexPath.section == 1) {
return CGSizeMake(w, 106);
return CGSizeMake(w, KBFit(75 + 6));
} else {
return CGSizeMake(w, 140);
}
@@ -142,7 +155,7 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
if (section == 0) {
// = 484 +
return CGSizeMake(KB_SCREEN_WIDTH, 484 + KB_NAV_TOTAL_HEIGHT);
return CGSizeMake(KB_SCREEN_WIDTH, 474 + KB_NAV_TOTAL_HEIGHT);
}
return CGSizeZero;
}
@@ -154,7 +167,8 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
if (section == 1) {
return UIEdgeInsetsMake(0, 16, 10, 16);
// cell header
return UIEdgeInsetsMake(16, 16, 10, 16);
} else if (section == 2) {
return UIEdgeInsetsMake(10, 16, 20, 16);
}
@@ -185,7 +199,7 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
- (UIButton *)closeButton {
if (!_closeButton) {
_closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_closeButton setImage:[UIImage imageNamed:@"white_close_icon"] forState:UIControlStateNormal];
[_closeButton setImage:[UIImage imageNamed:@"close_white2_icon"] forState:UIControlStateNormal];
[_closeButton addTarget:self action:@selector(onTapClose) forControlEvents:UIControlEventTouchUpInside];
}
return _closeButton;