diff --git a/keyBoard/Assets.xcassets/Shop/shop_goumai_icon.imageset/Contents.json b/keyBoard/Assets.xcassets/Shop/shop_goumai_icon.imageset/Contents.json new file mode 100644 index 0000000..e05c16e --- /dev/null +++ b/keyBoard/Assets.xcassets/Shop/shop_goumai_icon.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "shop_goumai_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "shop_goumai_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/keyBoard/Assets.xcassets/Shop/shop_goumai_icon.imageset/shop_goumai_icon@2x.png b/keyBoard/Assets.xcassets/Shop/shop_goumai_icon.imageset/shop_goumai_icon@2x.png new file mode 100644 index 0000000..8540358 Binary files /dev/null and b/keyBoard/Assets.xcassets/Shop/shop_goumai_icon.imageset/shop_goumai_icon@2x.png differ diff --git a/keyBoard/Assets.xcassets/Shop/shop_goumai_icon.imageset/shop_goumai_icon@3x.png b/keyBoard/Assets.xcassets/Shop/shop_goumai_icon.imageset/shop_goumai_icon@3x.png new file mode 100644 index 0000000..f14107b Binary files /dev/null and b/keyBoard/Assets.xcassets/Shop/shop_goumai_icon.imageset/shop_goumai_icon@3x.png differ diff --git a/keyBoard/Class/Shop/VC/KBShopVC.m b/keyBoard/Class/Shop/VC/KBShopVC.m index 34991e0..37d40f8 100644 --- a/keyBoard/Class/Shop/VC/KBShopVC.m +++ b/keyBoard/Class/Shop/VC/KBShopVC.m @@ -15,6 +15,7 @@ #import "KBShopItemVC.h" #import "KBSearchVC.h" #import "MySkinVC.h" +#import "KBConsumptionRecordVC.h" #import "KBWebViewViewController.h" @@ -39,6 +40,7 @@ static const CGFloat JXheightForHeaderInSection = 50; @property (nonatomic, strong) UIImageView *bgImageView; // 全屏背景图 @property (nonatomic, strong) UIButton *searchBtn; @property (nonatomic, strong) UIButton *skinBtn; +@property (nonatomic, strong) UIButton *recordButton; // 记录当前分类条是否为白底,避免重复设置 @property (nonatomic, assign) BOOL categoryIsWhite; @property (nonatomic, strong) KBShopVM *shopVM; @@ -58,6 +60,7 @@ static const CGFloat JXheightForHeaderInSection = 50; [self setupUI]; [self.view addSubview:self.skinBtn]; [self.view addSubview:self.searchBtn]; + [self.view addSubview:self.recordButton]; [self.skinBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.view).offset(-16); make.top.mas_equalTo(KB_NAV_TOTAL_HEIGHT - 25); @@ -68,6 +71,12 @@ static const CGFloat JXheightForHeaderInSection = 50; make.top.equalTo(self.skinBtn); 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]; @@ -254,6 +263,11 @@ static const CGFloat JXheightForHeaderInSection = 50; [self.navigationController pushViewController:vc animated:true]; } +- (void)recordButtonAction{ + KBConsumptionRecordVC *vc = [[KBConsumptionRecordVC alloc] init]; + [self.navigationController pushViewController:vc animated:true]; +} + #pragma mark - lazy - (UIButton *)searchBtn{ if (!_searchBtn) { @@ -272,6 +286,23 @@ static const CGFloat JXheightForHeaderInSection = 50; 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 { if (!_shopVM) { _shopVM = [[KBShopVM alloc] init];