1
This commit is contained in:
@@ -61,6 +61,8 @@
|
||||
@property (nonatomic, strong) UIView *cardView; // 卡片背景(圆角)
|
||||
@property (nonatomic, strong) UIStackView *topStack; // 顶部水平栈:金币 + 数字(整体居中)
|
||||
@property (nonatomic, strong) UIImageView *iconView; // 左侧金币图
|
||||
@property (nonatomic, strong) UIImageView *gradientImageView; // 左侧金币图
|
||||
|
||||
@property (nonatomic, strong) UILabel *coinLabel; // 690
|
||||
@property (nonatomic, strong) UILabel *priceLabel; // $6.90
|
||||
|
||||
@@ -76,6 +78,8 @@
|
||||
self.contentView.backgroundColor = UIColor.clearColor;
|
||||
|
||||
[self.contentView addSubview:self.cardView];
|
||||
[self.cardView addSubview:self.gradientImageView];
|
||||
|
||||
// 顶部金币 + 数字放入一个水平栈,保证整体居中
|
||||
[self.cardView addSubview:self.topStack];
|
||||
[self.topStack addArrangedSubview:self.iconView];
|
||||
@@ -86,6 +90,9 @@
|
||||
[self.cardView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.contentView);
|
||||
}];
|
||||
[self.gradientImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.cardView);
|
||||
}];
|
||||
[self.topStack mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.cardView).offset(16);
|
||||
make.centerX.equalTo(self.cardView); // 整体水平居中
|
||||
@@ -177,7 +184,8 @@
|
||||
if (!_cardView) {
|
||||
_cardView = [UIView new];
|
||||
// 淡灰渐变效果可用切图/渐变,这里简化为纯色
|
||||
_cardView.backgroundColor = [UIColor colorWithWhite:0.98 alpha:1.0];
|
||||
|
||||
_cardView.backgroundColor = [UIColor colorWithHex:0xF1F1F1];
|
||||
}
|
||||
return _cardView;
|
||||
}
|
||||
@@ -190,6 +198,15 @@
|
||||
return _iconView;
|
||||
}
|
||||
|
||||
- (UIImageView *)gradientImageView{
|
||||
if (!_gradientImageView) {
|
||||
_gradientImageView = [[UIImageView alloc] init];
|
||||
UIImage *gradientImage = [UIImage kb_gradientImageWithColors:@[[UIColor colorWithHex:0xF1F1F1], [UIColor colorWithHex:0xFFFFFF]] size:CGSizeMake(108, 116) direction:KBGradientDirectionTopToBottom];
|
||||
_gradientImageView.image = gradientImage;
|
||||
}
|
||||
return _gradientImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)coinLabel {
|
||||
if (!_coinLabel) {
|
||||
_coinLabel = [UILabel new];
|
||||
|
||||
Reference in New Issue
Block a user