Files
yinmeng-ios/xplan-ios/Main/Mine/View/SubViews/XPMineAccountView.m
2022-07-25 18:56:36 +08:00

93 lines
2.3 KiB
Objective-C

//
// XPMineAccountView.m
// xplan-ios
//
// Created by GreenLand on 2022/7/22.
//
#import "XPMineAccountView.h"
#import <Masonry/Masonry.h>
#import "ThemeColor.h"
@interface XPMineAccountView ()
@property (nonatomic, strong) UIImageView *bgImageView;
@property (nonatomic, strong) UILabel *coinLabel;
@property (nonatomic, strong) UILabel *descLabel;
@end
@implementation XPMineAccountView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.bgImageView];
[self addSubview:self.coinLabel];
[self addSubview:self.descLabel];
}
- (void)initSubViewConstraints {
[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);
}];
}
- (void)setDiamonds:(NSString *)diamonds {
self.coinLabel.text = diamonds;
}
#pragma mark - Getters And Setters
- (UIImageView *)bgImageView {
if (!_bgImageView) {
_bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_head_account_bg"]];
_bgImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _bgImageView;
}
- (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;
}
- (UILabel *)coinLabel {
if (!_coinLabel) {
_coinLabel = [[UILabel alloc] init];
_coinLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightBold];
_coinLabel.textColor = [ThemeColor mainTextColor];
}
return _coinLabel;
}
@end