2021-09-16 19:30:22 +08:00
|
|
|
//
|
|
|
|
// XPMineAccountView.m
|
|
|
|
// xplan-ios
|
|
|
|
//
|
|
|
|
// Created by 冯硕 on 2021/9/16.
|
|
|
|
// 我的账户 推荐给好友
|
|
|
|
|
|
|
|
#import "XPMineAccountView.h"
|
|
|
|
///Third
|
|
|
|
#import <Masonry/Masonry.h>
|
|
|
|
///Tool
|
|
|
|
#import "ThemeColor.h"
|
2021-12-21 18:10:33 +08:00
|
|
|
#import "XPMacro.h"
|
2021-09-16 19:30:22 +08:00
|
|
|
#import "UIImage+Utils.h"
|
|
|
|
|
|
|
|
@implementation XPMineAccountSubView
|
|
|
|
|
|
|
|
- (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.backImageView];
|
|
|
|
[self addSubview:self.titleLabel];
|
|
|
|
[self addSubview:self.freeTicketButton];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)initSubViewConstraints {
|
|
|
|
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.edges.mas_equalTo(self);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.top.mas_equalTo(self.backImageView).offset(18);
|
|
|
|
make.left.mas_equalTo(self.backImageView).offset(16);
|
|
|
|
make.right.mas_lessThanOrEqualTo(self.backImageView);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.freeTicketButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.right.top.mas_equalTo(self.backImageView);
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIImageView *)backImageView {
|
|
|
|
if (!_backImageView) {
|
|
|
|
_backImageView = [[UIImageView alloc] init];
|
|
|
|
_backImageView.userInteractionEnabled = YES;
|
|
|
|
_backImageView.layer.masksToBounds = YES;
|
|
|
|
_backImageView.layer.cornerRadius = 10;
|
|
|
|
_backImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
|
}
|
|
|
|
return _backImageView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UILabel *)titleLabel {
|
|
|
|
if (!_titleLabel) {
|
|
|
|
_titleLabel = [[UILabel alloc] init];
|
|
|
|
_titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Bold" size:16];
|
|
|
|
_titleLabel.textColor = [ThemeColor mainTextColor];
|
|
|
|
}
|
|
|
|
return _titleLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIButton *)freeTicketButton {
|
|
|
|
if (!_freeTicketButton) {
|
|
|
|
_freeTicketButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
[_freeTicketButton setBackgroundImage:[UIImage imageNamed:@"mine_head_free_ticket"] forState:UIControlStateNormal];
|
|
|
|
}
|
|
|
|
return _freeTicketButton;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@interface XPMineAccountView ()
|
|
|
|
///我的账户
|
|
|
|
@property (nonatomic,strong) XPMineAccountSubView *accountView;
|
|
|
|
///推荐好友
|
|
|
|
@property (nonatomic,strong) XPMineAccountSubView *recommendView;
|
|
|
|
|
|
|
|
@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 {
|
2021-12-07 14:57:33 +08:00
|
|
|
[self addSubview:self.accountView];
|
|
|
|
[self addSubview:self.recommendView];
|
2021-09-16 19:30:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)initSubViewConstraints {
|
2021-12-07 14:57:33 +08:00
|
|
|
[self.accountView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2021-12-21 18:10:33 +08:00
|
|
|
make.left.mas_equalTo(self).offset(15);
|
2021-09-16 19:30:22 +08:00
|
|
|
make.top.bottom.mas_equalTo(self);
|
2021-12-21 18:10:33 +08:00
|
|
|
make.width.mas_equalTo((KScreenWidth - 15 * 3) / 2);
|
2021-12-07 14:57:33 +08:00
|
|
|
}];
|
|
|
|
|
|
|
|
[self.recommendView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.right.mas_equalTo(self).offset(-15);
|
|
|
|
make.top.bottom.width.mas_equalTo(self.accountView);
|
2021-09-16 19:30:22 +08:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
|
|
|
|
|
|
- (XPMineAccountSubView *)accountView {
|
|
|
|
if (!_accountView) {
|
|
|
|
_accountView = [[XPMineAccountSubView alloc] init];
|
|
|
|
_accountView.backImageView.image = [UIImage imageNamed:@"mine_head_account_bg"];
|
|
|
|
_accountView.titleLabel.text = @"我的账户";
|
|
|
|
_accountView.freeTicketButton.hidden = YES;
|
|
|
|
}
|
|
|
|
return _accountView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPMineAccountSubView *)recommendView {
|
|
|
|
if (!_recommendView) {
|
|
|
|
_recommendView = [[XPMineAccountSubView alloc] init];
|
|
|
|
_recommendView.backImageView.image = [UIImage imageNamed:@"mine_head_recommend_bg"];
|
|
|
|
_recommendView.titleLabel.text = @"推荐给好友";
|
|
|
|
}
|
|
|
|
return _recommendView;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|