1
This commit is contained in:
@@ -23,6 +23,10 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
|
||||
// Header 自适应测量
|
||||
@property (nonatomic, strong) KBVipPayHeaderView *sizingHeader;
|
||||
@property (nonatomic, assign) CGFloat headerHeight;
|
||||
// 底部支付与协议
|
||||
@property (nonatomic, strong) UIButton *payButton; // 支付按钮(背景图)
|
||||
@property (nonatomic, strong) UILabel *agreementLabel; // 协议提示
|
||||
@property (nonatomic, strong) UIButton *agreementButton; // 《Embership Agreement》
|
||||
|
||||
@end
|
||||
|
||||
@@ -52,9 +56,28 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
|
||||
|
||||
// 组装主列表
|
||||
[self.view addSubview:self.collectionView];
|
||||
// 先添加底部按钮与协议,再让 collectionView 的底部在按钮之上
|
||||
[self.view addSubview:self.payButton];
|
||||
[self.view addSubview:self.agreementLabel];
|
||||
[self.view addSubview:self.agreementButton];
|
||||
[self.payButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
make.bottom.equalTo(self.agreementLabel.mas_top).offset(-14);
|
||||
make.height.mas_equalTo(58);
|
||||
}];
|
||||
[self.agreementButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.view);
|
||||
make.bottom.equalTo(self.view).offset(-KB_SAFE_BOTTOM - 15);
|
||||
}];
|
||||
[self.agreementLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.view);
|
||||
make.bottom.equalTo(self.agreementButton.mas_top).offset(-8);
|
||||
}];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.equalTo(self.view);
|
||||
make.left.right.equalTo(self.view);
|
||||
make.top.equalTo(self.view).offset(0);
|
||||
make.bottom.equalTo(self.payButton.mas_top).offset(-16);
|
||||
}];
|
||||
[self.view addSubview:self.closeButton];
|
||||
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -101,6 +124,15 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
|
||||
[self.navigationController popViewControllerAnimated:true];
|
||||
}
|
||||
|
||||
#pragma mark - Bottom Actions
|
||||
- (void)onTapPayButton {
|
||||
// TODO: 接入支付,这里仅做 UI
|
||||
[KBHUD showInfo:@"Pay clicked"];
|
||||
}
|
||||
- (void)agreementButtonAction{
|
||||
[KBHUD showInfo:@"跳转协议"];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionView DataSource
|
||||
|
||||
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
|
||||
@@ -230,6 +262,46 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
|
||||
return _closeButton;
|
||||
}
|
||||
|
||||
- (UIButton *)payButton {
|
||||
if (!_payButton) {
|
||||
_payButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_payButton setTitle:@"Recharge Now" forState:UIControlStateNormal];
|
||||
[_payButton setTitleColor:[UIColor colorWithHex:KBBlackValue] forState:UIControlStateNormal];
|
||||
_payButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
UIImage *bg = [UIImage imageNamed:@"recharge_now_icon"];
|
||||
if (bg) {
|
||||
[_payButton setBackgroundImage:bg forState:UIControlStateNormal];
|
||||
} else {
|
||||
// 兜底:纯代码渐变
|
||||
UIImage *fallback = [UIImage kb_gradientImageWithColors:@[[UIColor colorWithHex:0xC7F8F0], [UIColor colorWithHex:0xE8FFF6]] size:CGSizeMake(10, 58) direction:KBGradientDirectionLeftToRight];
|
||||
[_payButton setBackgroundImage:[fallback resizableImageWithCapInsets:UIEdgeInsetsMake(29, 29, 29, 29) resizingMode:UIImageResizingModeStretch] forState:UIControlStateNormal];
|
||||
}
|
||||
[_payButton addTarget:self action:@selector(onTapPayButton) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _payButton;
|
||||
}
|
||||
|
||||
- (UILabel *)agreementLabel {
|
||||
if (!_agreementLabel) {
|
||||
_agreementLabel = [UILabel new];
|
||||
_agreementLabel.text = @"By clicking \"Pay\", you indicate your agreement to the";
|
||||
_agreementLabel.font = [UIFont systemFontOfSize:12];
|
||||
_agreementLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
}
|
||||
return _agreementLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)agreementButton {
|
||||
if (!_agreementButton) {
|
||||
_agreementButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_agreementButton setTitle:@"《Embership Agreement》" forState:UIControlStateNormal];
|
||||
[_agreementButton setTitleColor:[UIColor colorWithHex:KBColorValue] forState:UIControlStateNormal];
|
||||
_agreementButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightSemibold];
|
||||
[_agreementButton addTarget:self action:@selector(agreementButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _agreementButton;
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews {
|
||||
[super viewDidLayoutSubviews];
|
||||
// 宽度变化时重算 Header 高度并刷新布局
|
||||
|
||||
Reference in New Issue
Block a user