84 lines
2.8 KiB
Objective-C
84 lines
2.8 KiB
Objective-C
//
|
|
// TFFeedBackHeaderView.m
|
|
// TFReader
|
|
//
|
|
// Created by 谢腾飞 on 2020/12/22.
|
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
|
//
|
|
|
|
#import "TFFeedBackHeaderView.h"
|
|
|
|
@implementation TFFeedBackHeaderView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
{
|
|
if (self = [super initWithFrame:frame]) {
|
|
[self createSubviews];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)createSubviews
|
|
{
|
|
TFButton *leftButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"首页我的反馈") buttonSubTitle:@"" buttonImageName:@"feedback_talk" buttonIndicator:TFButtonIndicatorTitleRight showMaskView:NO];
|
|
leftButton.graphicDistance = 1;
|
|
leftButton.buttonImageScale = 0.4;
|
|
leftButton.buttonTitleFont = kBoldFont15;
|
|
leftButton.tag = 1;
|
|
[leftButton addTarget:self action:@selector(menuClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
[self addSubview:leftButton];
|
|
|
|
[leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(self.mas_left);
|
|
make.top.mas_equalTo(self.mas_top);
|
|
make.height.mas_equalTo(self.mas_height);
|
|
make.width.mas_equalTo(self.mas_width).multipliedBy(0.5);
|
|
}];
|
|
|
|
UIView *line = [[UIView alloc] init];
|
|
line.backgroundColor = kGrayViewColor;
|
|
[self addSubview:line];
|
|
|
|
[line mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(leftButton.mas_right);
|
|
make.centerY.mas_equalTo(leftButton.mas_centerY);
|
|
make.width.mas_equalTo(2);
|
|
make.height.mas_equalTo(self.mas_height).with.multipliedBy(0.5);
|
|
}];
|
|
|
|
TFButton *rightButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"反馈意见") buttonSubTitle:@"" buttonImageName:@"feedback_list" buttonIndicator:TFButtonIndicatorTitleRight showMaskView:NO];
|
|
rightButton.graphicDistance = 1;
|
|
rightButton.buttonImageScale = 0.4;
|
|
rightButton.buttonTitleFont = kBoldFont15;
|
|
rightButton.tag = 2;
|
|
[rightButton addTarget:self action:@selector(menuClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
[self addSubview:rightButton];
|
|
|
|
[rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.mas_equalTo(self.mas_right);
|
|
make.top.mas_equalTo(self.mas_top);
|
|
make.height.mas_equalTo(self.mas_height);
|
|
make.width.mas_equalTo(self.mas_width).multipliedBy(0.5);
|
|
}];
|
|
}
|
|
|
|
- (void)menuClick:(UIButton *)sender
|
|
{
|
|
if (!TFUserInfoManager.isLogin) {
|
|
[TFLoginOptionsViewController presentLoginView:nil];
|
|
return;
|
|
}
|
|
|
|
if (sender.tag == 1) {
|
|
if (self.leftButtonClick) {
|
|
self.leftButtonClick();
|
|
}
|
|
} else if (sender.tag == 2) {
|
|
if (self.rightButtonClick) {
|
|
self.rightButtonClick();
|
|
}
|
|
}
|
|
}
|
|
|
|
@end
|