Files
yinmeng-ios/xplan-ios/Main/Mine/View/SubViews/XPMineAccountView.m

93 lines
2.3 KiB
Mathematica
Raw Normal View History

2021-09-16 19:30:22 +08:00
//
// XPMineAccountView.m
// xplan-ios
//
2022-07-22 18:48:23 +08:00
// Created by GreenLand on 2022/7/22.
//
2021-09-16 19:30:22 +08:00
#import "XPMineAccountView.h"
#import <Masonry/Masonry.h>
#import "ThemeColor.h"
2022-07-22 18:48:23 +08:00
@interface XPMineAccountView ()
@property (nonatomic, strong) UIImageView *bgImageView;
@property (nonatomic, strong) UILabel *coinLabel;
@property (nonatomic, strong) UILabel *descLabel;
@end
@implementation XPMineAccountView
2021-09-16 19:30:22 +08:00
- (instancetype)initWithFrame:(CGRect)frame
{
2022-07-22 18:48:23 +08:00
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
2021-09-16 19:30:22 +08:00
}
#pragma mark - Private Method
- (void)initSubViews {
2022-07-22 18:48:23 +08:00
[self addSubview:self.bgImageView];
[self addSubview:self.coinLabel];
[self addSubview:self.descLabel];
2021-09-16 19:30:22 +08:00
}
- (void)initSubViewConstraints {
2022-07-22 18:48:23 +08:00
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.coinLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.mas_centerY);
make.left.mas_equalTo(15);
make.right.mas_equalTo(0);
make.height.mas_equalTo(24);
}];
[self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.coinLabel);
make.top.mas_equalTo(self.coinLabel.mas_bottom).mas_offset(4);
make.height.mas_equalTo(14);
}];
2021-09-16 19:30:22 +08:00
}
2022-07-22 18:48:23 +08:00
- (void)setDiamonds:(NSString *)diamonds {
self.coinLabel.text = diamonds;
2021-09-16 19:30:22 +08:00
}
2022-07-22 18:48:23 +08:00
#pragma mark - Getters And Setters
- (UIImageView *)bgImageView {
if (!_bgImageView) {
_bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_head_account_bg"]];
_bgImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _bgImageView;
2021-09-16 19:30:22 +08:00
}
2022-07-22 18:48:23 +08:00
- (UILabel *)descLabel {
if (!_descLabel) {
_descLabel = [[UILabel alloc] init];
_descLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
_descLabel.textColor = UIColorRGBAlpha(0x000000, 0.3);
_descLabel.text = @"钻石余额";
}
return _descLabel;
2021-09-16 19:30:22 +08:00
}
2022-07-22 18:48:23 +08:00
- (UILabel *)coinLabel {
if (!_coinLabel) {
_coinLabel = [[UILabel alloc] init];
_coinLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightBold];
_coinLabel.textColor = [ThemeColor mainTextColor];
}
return _coinLabel;
2021-09-16 19:30:22 +08:00
}
@end