110 lines
3.6 KiB
Objective-C
110 lines
3.6 KiB
Objective-C
//
|
|
// YMFootPrintNavView.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2022/7/26.
|
|
//
|
|
|
|
#import "XPFootPrintNavView.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
///Tool
|
|
#import "DJDKMIMOMColor.h"
|
|
#import "UIButton+EnlargeTouchArea.h"
|
|
|
|
@interface XPFootPrintNavView ()
|
|
|
|
///返回按钮
|
|
@property (nonatomic,strong) UIButton *backButton;
|
|
///显示文本
|
|
@property (nonatomic,strong) UILabel *titleLabel;
|
|
///设置按钮
|
|
@property (nonatomic, strong) UIButton *settingButton;
|
|
|
|
@end
|
|
|
|
|
|
@implementation XPFootPrintNavView
|
|
|
|
- (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(xPFootPrintNavView:didClickBackButton:)]) {
|
|
[self.delegate xPFootPrintNavView:self didClickBackButton:sender];
|
|
}
|
|
}
|
|
|
|
- (void)clearButtonAction:(UIButton *)sender {
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPFootPrintNavView:didClickClearButton:)]) {
|
|
[self.delegate xPFootPrintNavView:self didClickClearButton:sender];
|
|
}
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
self.backgroundColor = [UIColor clearColor];
|
|
[self addSubview:self.backButton];
|
|
[self addSubview:self.titleLabel];
|
|
[self addSubview:self.settingButton];
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(15);
|
|
make.centerY.equalTo(self.mas_bottom).mas_offset(-22);
|
|
}];
|
|
[self.settingButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.trailing.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:@"common_nav_back"]ms_SetImageForRTL] forState:UIControlStateNormal];
|
|
_backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
|
[_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
[_backButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
|
}
|
|
return _backButton;
|
|
}
|
|
|
|
- (UIButton *)settingButton {
|
|
if (!_settingButton) {
|
|
_settingButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_settingButton setTitle:YMLocalizedString(@"XPFootPrintNavView0") forState:UIControlStateNormal];
|
|
_settingButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
|
[_settingButton setTitleColor:[DJDKMIMOMColor textThirdColor] forState:UIControlStateNormal];
|
|
[_settingButton addTarget:self action:@selector(clearButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
[_settingButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
|
}
|
|
return _settingButton;
|
|
}
|
|
|
|
- (UILabel *)titleLabel {
|
|
if (!_titleLabel) {
|
|
_titleLabel = [[UILabel alloc] init];
|
|
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
_titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
|
|
_titleLabel.text = YMLocalizedString(@"XPFootPrintNavView1");
|
|
_titleLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
|
}
|
|
return _titleLabel;
|
|
}
|
|
|
|
@end
|