3
This commit is contained in:
@@ -15,7 +15,12 @@
|
||||
// 顶部左侧标题与点缀
|
||||
@property (nonatomic, strong) UILabel *titleLabel; // "Points\nMall"
|
||||
@property (nonatomic, strong) UIImageView *yellowStarView; // 左侧黄色装饰星:shop_yellowxx_icon
|
||||
@property (nonatomic, strong) UIImageView *yellowStarView2; // 左侧黄色装饰星:shop_yellowxx_icon
|
||||
|
||||
@property (nonatomic, strong) UIImageView *greenStarView; // 右上角绿色装饰星:shop_greenxx_icon
|
||||
@property (nonatomic, strong) UIImageView *greenStarView2; // 右上角绿色装饰星:shop_greenxx_icon
|
||||
@property (nonatomic, strong) UIImageView *greenStarView3; // 右上角绿色装饰星:shop_greenxx_icon
|
||||
|
||||
|
||||
// 右侧大金币
|
||||
@property (nonatomic, strong) UIImageView *bigCoinView; // shop_headbigBg_icon
|
||||
@@ -38,9 +43,12 @@
|
||||
// 组装视图层级
|
||||
[self addSubview:self.containerView];
|
||||
[self.containerView addSubview:self.titleLabel];
|
||||
[self.containerView addSubview:self.yellowStarView];
|
||||
[self.containerView addSubview:self.greenStarView];
|
||||
[self.containerView addSubview:self.bigCoinView];
|
||||
[self.containerView addSubview:self.yellowStarView];
|
||||
[self.containerView addSubview:self.yellowStarView2];
|
||||
[self.containerView addSubview:self.greenStarView];
|
||||
[self.containerView addSubview:self.greenStarView2];
|
||||
[self.containerView addSubview:self.greenStarView3];
|
||||
[self.containerView addSubview:self.infoCard];
|
||||
[self.infoCard addSubview:self.myPointsLabel];
|
||||
[self.infoCard addSubview:self.smallCoinView];
|
||||
@@ -57,21 +65,36 @@
|
||||
|
||||
// 左侧标题
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.left.equalTo(self.containerView).offset(0);
|
||||
make.bottom.equalTo(self.containerView).offset(0);
|
||||
make.left.equalTo(self.containerView).offset(32);
|
||||
make.top.equalTo(self.containerView).offset(KB_NAV_TOTAL_HEIGHT + 20);
|
||||
}];
|
||||
|
||||
// 左侧黄色装饰星
|
||||
[self.yellowStarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.titleLabel.mas_centerY).offset(6);
|
||||
make.left.equalTo(self.containerView).offset(6);
|
||||
make.width.height.mas_equalTo(18);
|
||||
}];
|
||||
[self.yellowStarView2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.titleLabel.mas_top).offset(6);
|
||||
make.left.equalTo(self.titleLabel.mas_right).offset(6);
|
||||
make.width.height.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
// 右上角绿色装饰星
|
||||
[self.greenStarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.containerView).offset(10);
|
||||
make.right.equalTo(self.containerView).offset(-6);
|
||||
make.top.equalTo(self.yellowStarView2).offset(0);
|
||||
make.left.equalTo(self.yellowStarView2.mas_right).offset(62);
|
||||
make.width.height.mas_equalTo(20);
|
||||
}];
|
||||
[self.greenStarView2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.greenStarView.mas_bottom).offset(10);
|
||||
make.right.equalTo(self.containerView).offset(-18);
|
||||
make.width.height.mas_equalTo(14);
|
||||
}];
|
||||
[self.greenStarView3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.greenStarView2.mas_bottom).offset(20);
|
||||
make.right.equalTo(self.containerView).offset(0);
|
||||
make.width.height.mas_equalTo(14);
|
||||
}];
|
||||
|
||||
@@ -91,25 +114,25 @@
|
||||
|
||||
[self.myPointsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.infoCard).offset(16);
|
||||
make.top.equalTo(self.infoCard).offset(16);
|
||||
make.bottom.equalTo(self.smallCoinView.mas_top).offset(-16);
|
||||
}];
|
||||
|
||||
[self.smallCoinView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.infoCard).offset(16);
|
||||
make.top.equalTo(self.myPointsLabel.mas_bottom).offset(12);
|
||||
make.width.height.mas_equalTo(36);
|
||||
make.centerY.equalTo(self.amountLabel);
|
||||
make.width.height.mas_equalTo(38);
|
||||
}];
|
||||
|
||||
[self.amountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.smallCoinView.mas_right).offset(10);
|
||||
make.centerY.equalTo(self.smallCoinView);
|
||||
make.centerY.equalTo(self.rechargeButton);
|
||||
}];
|
||||
|
||||
[self.rechargeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.amountLabel);
|
||||
make.right.equalTo(self.infoCard).offset(-16);
|
||||
make.width.mas_equalTo(120);
|
||||
make.height.mas_equalTo(40);
|
||||
make.bottom.equalTo(self.infoCard).offset(-32);
|
||||
make.right.equalTo(self.infoCard).offset(-15);
|
||||
make.width.mas_equalTo(114);
|
||||
make.height.mas_equalTo(42);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
@@ -180,6 +203,13 @@
|
||||
}
|
||||
return _yellowStarView;
|
||||
}
|
||||
- (UIImageView *)yellowStarView2 {
|
||||
if (!_yellowStarView2) {
|
||||
_yellowStarView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"shop_yellowxx_icon"]];
|
||||
_yellowStarView2.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _yellowStarView2;
|
||||
}
|
||||
|
||||
- (UIImageView *)greenStarView {
|
||||
if (!_greenStarView) {
|
||||
@@ -188,6 +218,20 @@
|
||||
}
|
||||
return _greenStarView;
|
||||
}
|
||||
- (UIImageView *)greenStarView2 {
|
||||
if (!_greenStarView2) {
|
||||
_greenStarView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"shop_greenxx_icon"]];
|
||||
_greenStarView2.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _greenStarView2;
|
||||
}
|
||||
- (UIImageView *)greenStarView3 {
|
||||
if (!_greenStarView3) {
|
||||
_greenStarView3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"shop_greenxx_icon"]];
|
||||
_greenStarView3.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _greenStarView3;
|
||||
}
|
||||
|
||||
- (UIImageView *)bigCoinView {
|
||||
if (!_bigCoinView) {
|
||||
@@ -208,8 +252,8 @@
|
||||
if (!_myPointsLabel) {
|
||||
_myPointsLabel = [UILabel new];
|
||||
_myPointsLabel.text = @"My Points";
|
||||
_myPointsLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
_myPointsLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
|
||||
_myPointsLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_myPointsLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold];
|
||||
}
|
||||
return _myPointsLabel;
|
||||
}
|
||||
@@ -225,11 +269,11 @@
|
||||
- (UILabel *)amountLabel {
|
||||
if (!_amountLabel) {
|
||||
_amountLabel = [UILabel new];
|
||||
_amountLabel.text = @"88.00"; // 默认文案
|
||||
_amountLabel.text = @"88.00";
|
||||
_amountLabel.textColor = [UIColor colorWithHex:KBColorValue];
|
||||
_amountLabel.font = [UIFont systemFontOfSize:38 weight:UIFontWeightBold];
|
||||
_amountLabel.font = [UIFont systemFontOfSize:40 weight:UIFontWeightBold];
|
||||
_amountLabel.adjustsFontSizeToFitWidth = YES;
|
||||
_amountLabel.minimumScaleFactor = 0.7;
|
||||
// _amountLabel.minimumScaleFactor = 0.7;
|
||||
}
|
||||
return _amountLabel;
|
||||
}
|
||||
@@ -238,25 +282,28 @@
|
||||
if (!_rechargeButton) {
|
||||
_rechargeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_rechargeButton setTitle:@"Recharge" forState:UIControlStateNormal];
|
||||
[_rechargeButton setTitleColor:[UIColor colorWithHex:0x1B1F1A] forState:UIControlStateNormal];
|
||||
_rechargeButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
|
||||
// 切图背景图(可拉伸)
|
||||
[_rechargeButton setTitleColor:[UIColor colorWithHex:KBBlackValue] forState:UIControlStateNormal];
|
||||
_rechargeButton.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold];
|
||||
UIImage *bg = [UIImage imageNamed:@"recharge_btn_bg"];
|
||||
if (bg) {
|
||||
CGFloat cap = 20; // 圆角拉伸区域
|
||||
bg = [bg resizableImageWithCapInsets:UIEdgeInsetsMake(cap, cap, cap, cap) resizingMode:UIImageResizingModeStretch];
|
||||
[_rechargeButton setBackgroundImage:bg forState:UIControlStateNormal];
|
||||
} else {
|
||||
// 兜底:用绿色渐变生成
|
||||
UIImage *fallback = [UIImage kb_gradientImageWithColors:@[[UIColor colorWithHex:0xA6F6E9], [UIColor colorWithHex:0xD6FFF4]]
|
||||
size:CGSizeMake(120, 40)
|
||||
direction:KBGradientDirectionLeftToRight];
|
||||
[_rechargeButton setBackgroundImage:fallback forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
_rechargeButton.layer.cornerRadius = 20;
|
||||
_rechargeButton.layer.masksToBounds = YES;
|
||||
[_rechargeButton setBackgroundImage:bg forState:UIControlStateNormal];
|
||||
|
||||
//
|
||||
// // 切图背景图(可拉伸)
|
||||
// UIImage *bg = [UIImage imageNamed:@"recharge_btn_bg"];
|
||||
// if (bg) {
|
||||
// CGFloat cap = 20; // 圆角拉伸区域
|
||||
// bg = [bg resizableImageWithCapInsets:UIEdgeInsetsMake(cap, cap, cap, cap) resizingMode:UIImageResizingModeStretch];
|
||||
// [_rechargeButton setBackgroundImage:bg forState:UIControlStateNormal];
|
||||
// } else {
|
||||
// // 兜底:用绿色渐变生成
|
||||
// UIImage *fallback = [UIImage kb_gradientImageWithColors:@[[UIColor colorWithHex:0xA6F6E9], [UIColor colorWithHex:0xD6FFF4]]
|
||||
// size:CGSizeMake(120, 40)
|
||||
// direction:KBGradientDirectionLeftToRight];
|
||||
// [_rechargeButton setBackgroundImage:fallback forState:UIControlStateNormal];
|
||||
// }
|
||||
//
|
||||
// _rechargeButton.layer.cornerRadius = 20;
|
||||
// _rechargeButton.layer.masksToBounds = YES;
|
||||
[_rechargeButton addTarget:self action:@selector(onRechargeTappedAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _rechargeButton;
|
||||
|
||||
Reference in New Issue
Block a user