2023-07-14 18:50:55 +08:00
|
|
|
//
|
|
|
|
// YMMineRechageHeadView.m
|
|
|
|
// YUMI
|
|
|
|
//
|
|
|
|
// Created by YUMI on 2021/9/24.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "XPMineRechageHeadView.h"
|
|
|
|
///Third
|
|
|
|
#import <Masonry/Masonry.h>
|
|
|
|
///Tool
|
|
|
|
#import "DJDKMIMOMColor.h"
|
|
|
|
#import "YUMIMacroUitls.h"
|
|
|
|
///Model
|
|
|
|
#import "WalletInfoModel.h"
|
|
|
|
|
|
|
|
@interface XPMineRechageHeadView ()
|
|
|
|
///大的背景
|
|
|
|
@property (nonatomic,strong) UIImageView *backImageView;
|
|
|
|
///底部的背景
|
|
|
|
@property (nonatomic,strong) UIImageView *bottomBackImg;
|
|
|
|
///显示钻石图标
|
|
|
|
@property (nonatomic,strong) UIImageView *coinImageView;
|
|
|
|
///显示我的钻石
|
|
|
|
@property (nonatomic,strong) UILabel *coinLabel;
|
|
|
|
///显示钻石数
|
|
|
|
@property (nonatomic,strong) UILabel *amountLabel;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@implementation XPMineRechageHeadView
|
|
|
|
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
|
if (self = [super initWithFrame:frame]) {
|
|
|
|
[self initView];
|
|
|
|
[self initContrations];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Private Method
|
|
|
|
- (void)initView {
|
|
|
|
[self addSubview:self.backImageView];
|
|
|
|
[self.backImageView addSubview:self.bottomBackImg];
|
|
|
|
[self.bottomBackImg addSubview:self.coinImageView];
|
|
|
|
[self.bottomBackImg addSubview:self.coinLabel];
|
|
|
|
[self.bottomBackImg addSubview:self.amountLabel];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)initContrations {
|
|
|
|
self.frame = CGRectMake(0, 0, KScreenWidth, 190 + kSafeAreaTopHeight);
|
|
|
|
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.edges.mas_equalTo(self);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.bottomBackImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-04-11 17:05:27 +08:00
|
|
|
make.leading.trailing.bottom.mas_equalTo(self.backImageView);
|
2023-07-14 18:50:55 +08:00
|
|
|
make.height.mas_equalTo(110);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.coinImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.size.mas_equalTo(CGSizeMake(21, 21));
|
|
|
|
make.top.mas_equalTo(self.bottomBackImg).offset(23);
|
2024-04-11 17:05:27 +08:00
|
|
|
make.trailing.mas_equalTo(self.coinLabel.mas_leading).offset(-4);
|
2023-07-14 18:50:55 +08:00
|
|
|
}];
|
|
|
|
|
|
|
|
[self.coinLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.centerY.mas_equalTo(self.coinImageView);
|
|
|
|
make.centerX.mas_equalTo(self.bottomBackImg.mas_centerX).offset(12);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.amountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.centerX.mas_equalTo(self.bottomBackImg);
|
|
|
|
make.top.mas_equalTo(self.coinImageView.mas_bottom).offset(1);
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Getters And Setters
|
|
|
|
- (void)setWalletInfo:(WalletInfoModel *)walletInfo {
|
|
|
|
_walletInfo = walletInfo;
|
|
|
|
if (_walletInfo) {
|
|
|
|
self.amountLabel.text = walletInfo.diamonds;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIImageView *)backImageView {
|
|
|
|
if (!_backImageView) {
|
|
|
|
_backImageView = [[UIImageView alloc] init];
|
|
|
|
_backImageView.userInteractionEnabled = YES;
|
|
|
|
_backImageView.image = [UIImage imageNamed:@"mine_recharge_header_bg"];
|
|
|
|
_backImageView.layer.masksToBounds = YES;
|
|
|
|
_backImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
|
}
|
|
|
|
return _backImageView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIImageView *)bottomBackImg {
|
|
|
|
if (!_bottomBackImg) {
|
|
|
|
_bottomBackImg = [[UIImageView alloc] init];
|
|
|
|
_bottomBackImg.userInteractionEnabled = YES;
|
|
|
|
_bottomBackImg.image = [UIImage imageNamed:@"mine_recharge_coin_bg"];
|
|
|
|
_bottomBackImg.layer.masksToBounds = YES;
|
|
|
|
_bottomBackImg.contentMode = UIViewContentModeScaleAspectFit;
|
|
|
|
}
|
|
|
|
return _bottomBackImg;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIImageView *)coinImageView {
|
|
|
|
if (!_coinImageView) {
|
|
|
|
_coinImageView = [[UIImageView alloc] init];
|
|
|
|
_coinImageView.userInteractionEnabled = YES;
|
2024-09-10 15:27:47 +08:00
|
|
|
_coinImageView.image = [UIImage imageNamed:@"moli_money_icon"];
|
2023-07-14 18:50:55 +08:00
|
|
|
}
|
|
|
|
return _coinImageView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UILabel *)coinLabel {
|
|
|
|
if (!_coinLabel) {
|
|
|
|
_coinLabel = [[UILabel alloc] init];
|
|
|
|
_coinLabel.text = YMLocalizedString(@"XPMineRechageHeadView0");
|
|
|
|
_coinLabel.font = [UIFont systemFontOfSize:13];
|
|
|
|
_coinLabel.textColor = [UIColor whiteColor];
|
|
|
|
}
|
|
|
|
return _coinLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UILabel *)amountLabel {
|
|
|
|
if (!_amountLabel) {
|
|
|
|
_amountLabel = [[UILabel alloc] init];
|
|
|
|
_amountLabel.font = [UIFont boldSystemFontOfSize:36];
|
|
|
|
_amountLabel.textColor = [DJDKMIMOMColor appMainColor];
|
|
|
|
_amountLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
|
}
|
|
|
|
return _amountLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|