处理按钮

This commit is contained in:
2025-12-23 14:15:27 +08:00
parent 262eb57b36
commit 8e4d7e1ee8
2 changed files with 34 additions and 34 deletions

View File

@@ -9,6 +9,7 @@
#import "KBJfPay.h" #import "KBJfPay.h"
#import "UIImageView+KBWebImage.h" #import "UIImageView+KBWebImage.h"
#import "KBShopThemeDetailModel.h" #import "KBShopThemeDetailModel.h"
#import "KBConsumptionRecordVC.h"
@interface KBShopHeadView () @interface KBShopHeadView ()
@@ -34,6 +35,7 @@
@property (nonatomic, strong) UIImageView *smallCoinView; // shop_jb_icon @property (nonatomic, strong) UIImageView *smallCoinView; // shop_jb_icon
@property (nonatomic, strong) UILabel *amountLabel; // 88.00 @property (nonatomic, strong) UILabel *amountLabel; // 88.00
@property (nonatomic, strong) UIButton *rechargeButton; // recharge_btn_bg @property (nonatomic, strong) UIButton *rechargeButton; // recharge_btn_bg
@property (nonatomic, strong) UIButton *recordButton; //
@end @end
@@ -52,6 +54,7 @@
[self.containerView addSubview:self.greenStarView]; [self.containerView addSubview:self.greenStarView];
[self.containerView addSubview:self.greenStarView2]; [self.containerView addSubview:self.greenStarView2];
[self.containerView addSubview:self.greenStarView3]; [self.containerView addSubview:self.greenStarView3];
[self.containerView addSubview:self.recordButton];
[self.containerView addSubview:self.infoCard]; [self.containerView addSubview:self.infoCard];
[self.infoCard addSubview:self.myPointsLabel]; [self.infoCard addSubview:self.myPointsLabel];
[self.infoCard addSubview:self.smallCoinView]; [self.infoCard addSubview:self.smallCoinView];
@@ -66,6 +69,13 @@
make.bottom.equalTo(self); make.bottom.equalTo(self);
}]; }];
[self.recordButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.containerView);
make.top.equalTo(self.containerView).offset(KB_NAV_TOTAL_HEIGHT - 25);
make.height.mas_equalTo(32);
make.width.mas_greaterThanOrEqualTo(136);
}];
// //
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.containerView).offset(32); make.left.equalTo(self.containerView).offset(32);
@@ -191,6 +201,11 @@
[KB_CURRENT_NAV pushViewController:vc animated:true]; [KB_CURRENT_NAV pushViewController:vc animated:true];
} }
- (void)onRecordButtonTappedAction {
KBConsumptionRecordVC *vc = [[KBConsumptionRecordVC alloc] init];
[KB_CURRENT_NAV pushViewController:vc animated:true];
}
#pragma mark - Lazy UI #pragma mark - Lazy UI
- (UIView *)containerView { - (UIView *)containerView {
if (!_containerView) { if (!_containerView) {
@@ -324,4 +339,21 @@
return _rechargeButton; return _rechargeButton;
} }
- (UIButton *)recordButton {
if (!_recordButton) {
_recordButton = [UIButton buttonWithType:UIButtonTypeCustom];
_recordButton.backgroundColor = [UIColor colorWithHex:0xE8FFFD];
_recordButton.layer.cornerRadius = 8;
_recordButton.layer.masksToBounds = YES;
[_recordButton setImage:[UIImage imageNamed:@"shop_goumai_icon"] forState:UIControlStateNormal];
[_recordButton setTitle:KBLocalized(@"Consumption Record") forState:UIControlStateNormal];
[_recordButton setTitleColor:[UIColor colorWithHex:KBColorValue] forState:UIControlStateNormal];
_recordButton.titleLabel.font = [KBFont medium:12];
_recordButton.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 12);
_recordButton.titleEdgeInsets = UIEdgeInsetsMake(0, 6, 0, -6);
[_recordButton addTarget:self action:@selector(onRecordButtonTappedAction) forControlEvents:UIControlEventTouchUpInside];
}
return _recordButton;
}
@end @end

View File

@@ -15,7 +15,6 @@
#import "KBShopItemVC.h" #import "KBShopItemVC.h"
#import "KBSearchVC.h" #import "KBSearchVC.h"
#import "MySkinVC.h" #import "MySkinVC.h"
#import "KBConsumptionRecordVC.h"
#import "KBWebViewViewController.h" #import "KBWebViewViewController.h"
@@ -40,7 +39,6 @@ static const CGFloat JXheightForHeaderInSection = 50;
@property (nonatomic, strong) UIImageView *bgImageView; // @property (nonatomic, strong) UIImageView *bgImageView; //
@property (nonatomic, strong) UIButton *searchBtn; @property (nonatomic, strong) UIButton *searchBtn;
@property (nonatomic, strong) UIButton *skinBtn; @property (nonatomic, strong) UIButton *skinBtn;
@property (nonatomic, strong) UIButton *recordButton;
// //
@property (nonatomic, assign) BOOL categoryIsWhite; @property (nonatomic, assign) BOOL categoryIsWhite;
@property (nonatomic, strong) KBShopVM *shopVM; @property (nonatomic, strong) KBShopVM *shopVM;
@@ -60,7 +58,6 @@ static const CGFloat JXheightForHeaderInSection = 50;
[self setupUI]; [self setupUI];
[self.view addSubview:self.skinBtn]; [self.view addSubview:self.skinBtn];
[self.view addSubview:self.searchBtn]; [self.view addSubview:self.searchBtn];
[self.view addSubview:self.recordButton];
[self.skinBtn mas_makeConstraints:^(MASConstraintMaker *make) { [self.skinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.view).offset(-16); make.right.equalTo(self.view).offset(-16);
make.top.mas_equalTo(KB_NAV_TOTAL_HEIGHT - 25); make.top.mas_equalTo(KB_NAV_TOTAL_HEIGHT - 25);
@@ -71,12 +68,6 @@ static const CGFloat JXheightForHeaderInSection = 50;
make.top.equalTo(self.skinBtn); make.top.equalTo(self.skinBtn);
make.width.height.mas_equalTo(25); make.width.height.mas_equalTo(25);
}]; }];
[self.recordButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.skinBtn);
make.left.equalTo(self.view).offset(14);
make.height.mas_equalTo(32);
make.width.mas_greaterThanOrEqualTo(136);
}];
[self fetchShopStylesWithHUD:YES]; [self fetchShopStylesWithHUD:YES];
@@ -117,9 +108,8 @@ static const CGFloat JXheightForHeaderInSection = 50;
self.categoryView.cellBackgroundColorGradientEnabled = YES; self.categoryView.cellBackgroundColorGradientEnabled = YES;
self.categoryView.cellBackgroundUnselectedColor = [UIColor colorWithHex:0xEFEFEF]; self.categoryView.cellBackgroundUnselectedColor = [UIColor colorWithHex:0xEFEFEF];
self.categoryView.cellBackgroundSelectedColor = [UIColor whiteColor]; self.categoryView.cellBackgroundSelectedColor = [UIColor whiteColor];
// Make the pills look compact self.categoryView.cellWidthIncrement = 20;
self.categoryView.cellWidthIncrement = 20; // horizontal padding for each item self.categoryView.cellSpacing = 12;
self.categoryView.cellSpacing = 12; // spacing between items
self.categoryView.contentEdgeInsetLeft = 16; self.categoryView.contentEdgeInsetLeft = 16;
self.categoryView.contentEdgeInsetRight = 16; self.categoryView.contentEdgeInsetRight = 16;
self.categoryView.averageCellSpacingEnabled = NO; self.categoryView.averageCellSpacingEnabled = NO;
@@ -263,11 +253,6 @@ static const CGFloat JXheightForHeaderInSection = 50;
[self.navigationController pushViewController:vc animated:true]; [self.navigationController pushViewController:vc animated:true];
} }
- (void)recordButtonAction{
KBConsumptionRecordVC *vc = [[KBConsumptionRecordVC alloc] init];
[self.navigationController pushViewController:vc animated:true];
}
#pragma mark - lazy #pragma mark - lazy
- (UIButton *)searchBtn{ - (UIButton *)searchBtn{
if (!_searchBtn) { if (!_searchBtn) {
@@ -286,23 +271,6 @@ static const CGFloat JXheightForHeaderInSection = 50;
return _skinBtn; return _skinBtn;
} }
- (UIButton *)recordButton{
if (!_recordButton) {
_recordButton = [UIButton buttonWithType:UIButtonTypeCustom];
_recordButton.backgroundColor = [UIColor colorWithHex:0xE8FFFD];
_recordButton.layer.cornerRadius = 8;
_recordButton.layer.masksToBounds = YES;
[_recordButton setImage:[UIImage imageNamed:@"shop_goumai_icon"] forState:UIControlStateNormal];
[_recordButton setTitle:KBLocalized(@"Consumption Record") forState:UIControlStateNormal];
[_recordButton setTitleColor:[UIColor colorWithHex:KBColorValue] forState:UIControlStateNormal];
_recordButton.titleLabel.font = [KBFont medium:12];
_recordButton.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 12);
_recordButton.titleEdgeInsets = UIEdgeInsetsMake(0, 6, 0, -6);
[_recordButton addTarget:self action:@selector(recordButtonAction) forControlEvents:UIControlEventTouchUpInside];
}
return _recordButton;
}
- (KBShopVM *)shopVM { - (KBShopVM *)shopVM {
if (!_shopVM) { if (!_shopVM) {
_shopVM = [[KBShopVM alloc] init]; _shopVM = [[KBShopVM alloc] init];