90 lines
2.9 KiB
Objective-C
90 lines
2.9 KiB
Objective-C
//
|
|
// QXWalletTopView.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2025/5/16.
|
|
//
|
|
|
|
#import "QXWalletTopView.h"
|
|
@interface QXWalletTopView()
|
|
@property (nonatomic,strong)UIImageView *topBgImageView;
|
|
@property (nonatomic,strong)UILabel *titleLabel;
|
|
@property (nonatomic,strong)UIImageView *cornImageView;
|
|
@property (nonatomic,strong)UILabel *moneyLabel;
|
|
@end
|
|
@implementation QXWalletTopView
|
|
|
|
- (instancetype)init
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
[self initSubviews];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
-(void)initSubviews{
|
|
self.topBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"wallet_top_bg"]];
|
|
[self addSubview:self.topBgImageView];
|
|
[self.topBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.bottom.right.top.equalTo(self);
|
|
}];
|
|
|
|
self.titleLabel = [[UILabel alloc] init];
|
|
self.titleLabel.text = QXText(@"金币余额");
|
|
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
|
self.titleLabel.textColor = QXConfig.textColor;
|
|
[self addSubview:self.titleLabel];
|
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self).offset(16);
|
|
make.top.equalTo(self).offset(22);
|
|
make.height.mas_equalTo(24);
|
|
}];
|
|
|
|
self.cornImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"wallet_corn"]];
|
|
[self addSubview:self.cornImageView];
|
|
[self.cornImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.titleLabel);
|
|
make.size.mas_equalTo(CGSizeMake(28, 28));
|
|
make.top.equalTo(self.titleLabel.mas_bottom).offset(13);
|
|
}];
|
|
|
|
self.moneyLabel = [[UILabel alloc] init];
|
|
self.moneyLabel.font = [UIFont boldSystemFontOfSize:35];
|
|
self.moneyLabel.textColor = QXConfig.textColor;
|
|
[self addSubview:self.moneyLabel];
|
|
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.cornImageView.mas_right).offset(4);
|
|
make.centerY.equalTo(self.cornImageView);
|
|
make.height.mas_equalTo(38);
|
|
}];
|
|
|
|
}
|
|
-(void)setType:(QXWalletTopViewType)type{
|
|
_type = type ;
|
|
switch (type) {
|
|
case QXWalletTopViewTypeRecharge:{
|
|
self.cornImageView.image = [UIImage imageNamed:@"wallet_corn"];
|
|
self.titleLabel.text = QXText(@"金币余额");
|
|
}
|
|
break;
|
|
case QXWalletTopViewTypeWithDraw:{
|
|
self.cornImageView.image = [UIImage imageNamed:@"wallet_diamond"];
|
|
self.titleLabel.text = QXText(@"我的钻石");
|
|
}
|
|
break;
|
|
case QXWalletTopViewTypeDiamond:{
|
|
self.cornImageView.image = [UIImage imageNamed:@"wallet_diamond"];
|
|
self.titleLabel.text = QXText(@"钻石余额");
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
-(void)setCoin:(NSString *)coin{
|
|
_coin = coin;
|
|
self.moneyLabel.text = coin;
|
|
}
|
|
@end
|