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

94 lines
2.5 KiB
Mathematica
Raw Normal View History

//
// XPNobleCenterEntranceView.m
// xplan-ios
//
// Created by GreenLand on 2022/1/6.
//
#import "XPNobleCenterEntranceView.h"
#import <Masonry/Masonry.h>
#import "ThemeColor.h"
@interface XPNobleCenterEntranceView ()
@property (nonatomic, strong) UIImageView *bgImageView;
@property (nonatomic, strong) UILabel *titleLabel;
2022-07-22 18:48:23 +08:00
@property (nonatomic, strong) UILabel *descLabel;
@end
@implementation XPNobleCenterEntranceView
- (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];
2022-07-22 18:48:23 +08:00
[self addSubview:self.titleLabel];
[self addSubview:self.descLabel];
}
- (void)initSubViewConstraints {
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
2022-07-22 18:48:23 +08:00
make.edges.mas_equalTo(0);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
2022-07-22 18:48:23 +08:00
make.bottom.mas_equalTo(self.mas_centerY);
make.left.mas_equalTo(48);
make.right.mas_equalTo(0);
make.height.mas_equalTo(22);
}];
[self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(2);
make.left.mas_equalTo(self.titleLabel);
make.right.mas_equalTo(0);
make.height.mas_equalTo(14);
}];
}
2022-01-10 20:31:56 +08:00
- (void)setHadNoble:(BOOL)hadNoble {
if (hadNoble) {
2022-07-22 18:48:23 +08:00
self.descLabel.text = @"查看我的特权";
2022-01-10 20:31:56 +08:00
}
}
#pragma mark - Getters And Setters
- (UIImageView *)bgImageView {
if (!_bgImageView) {
_bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_noble_entrance"]];
_bgImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _bgImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
2022-07-22 18:48:23 +08:00
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_titleLabel.textColor = UIColorFromRGB(0xFFE595);
_titleLabel.text = @"贵族中心";
}
return _titleLabel;
}
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 = UIColorFromRGB(0x9F8052);
_descLabel.text = @"开通贵族立享各项特权";
}
return _descLabel;
}
@end