83 lines
2.2 KiB
Objective-C
83 lines
2.2 KiB
Objective-C
//
|
|
// XPMineRechargeNavView.m
|
|
// xplan-ios
|
|
//
|
|
// Created by 冯硕 on 2021/9/26.
|
|
//
|
|
|
|
#import "XPMineRechargeNavView.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
///Tool
|
|
#import "ThemeColor.h"
|
|
#import "UIButton+EnlargeTouchArea.h"
|
|
|
|
@interface XPMineRechargeNavView ()
|
|
///返回按钮
|
|
@property (nonatomic,strong) UIButton *backButton;
|
|
///显示文本
|
|
@property (nonatomic,strong) UILabel *titleLabel;
|
|
@end
|
|
|
|
@implementation XPMineRechargeNavView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
self = [super initWithFrame:frame];
|
|
if (self) {
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
#pragma mark - Response
|
|
- (void)backButtonAction:(UIButton *)sender {
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineRechargeNavView:didClickBackButton:)]) {
|
|
[self.delegate xPMineRechargeNavView:self didClickBackButton:sender];
|
|
}
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
self.backgroundColor = [UIColor clearColor];
|
|
[self addSubview:self.backButton];
|
|
[self addSubview:self.titleLabel];
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(15);
|
|
make.centerY.equalTo(self.mas_bottom).mas_offset(-22);
|
|
}];
|
|
|
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.mas_equalTo(self);
|
|
make.centerY.equalTo(self.mas_bottom).mas_offset(-22);
|
|
}];
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
- (UIButton *)backButton {
|
|
if (!_backButton) {
|
|
_backButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_backButton setImage:[UIImage imageNamed:@"home_search_white_back"] forState:UIControlStateNormal];
|
|
_backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
|
[_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
[_backButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
|
}
|
|
return _backButton;
|
|
}
|
|
|
|
|
|
- (UILabel *)titleLabel {
|
|
if (!_titleLabel) {
|
|
_titleLabel = [[UILabel alloc] init];
|
|
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
_titleLabel.font = [UIFont systemFontOfSize:15];
|
|
_titleLabel.text = @"账户";
|
|
_titleLabel.textColor = [UIColor whiteColor];
|
|
}
|
|
return _titleLabel;
|
|
}
|
|
|
|
@end
|