You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
169 lines
6.2 KiB
169 lines
6.2 KiB
// |
|
// TFGenderViewController.m |
|
// TFReader |
|
// |
|
// Created by 谢腾飞 on 2020/12/14. |
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved. |
|
// |
|
|
|
#import "TFGenderViewController.h" |
|
#import "TFRecommendBookController.h" |
|
|
|
@interface TFGenderViewController () |
|
|
|
@property (nonatomic ,strong) YYLabel *titleTop; |
|
@property (nonatomic ,strong) YYLabel *titleBottom; |
|
@property (nonatomic ,strong) UIButton *nextStepButton; |
|
@property (nonatomic ,strong) UIButton *boyButton; |
|
@property (nonatomic ,strong) UIButton *girlButton; |
|
|
|
@end |
|
|
|
@implementation TFGenderViewController |
|
|
|
- (void)viewWillAppear:(BOOL)animated |
|
{ |
|
[super viewWillAppear:animated]; |
|
|
|
[self setStatusBarDefaultStyle]; |
|
} |
|
|
|
- (void)viewDidLoad |
|
{ |
|
[super viewDidLoad]; |
|
|
|
self.view.backgroundColor = kWhiteColor; |
|
|
|
[self hiddenNavigationBar:YES]; |
|
[self setupSubview]; |
|
[self setupSubviewFrame]; |
|
} |
|
|
|
- (void)setupSubview |
|
{ |
|
self.titleTop = [[YYLabel alloc] init]; |
|
self.titleTop.text = TFLocalizedString(@"你终于来了"); |
|
self.titleTop.textColor = kBlackColor; |
|
self.titleTop.textAlignment = NSTextAlignmentCenter; |
|
self.titleTop.textVerticalAlignment = YYTextVerticalAlignmentBottom; |
|
self.titleTop.font = kFont18; |
|
[self.view addSubview:self.titleTop]; |
|
|
|
|
|
self.titleBottom = [[YYLabel alloc] init]; |
|
self.titleBottom.text = TFLocalizedString(@"现在快选择你的性别吧"); |
|
self.titleBottom.textColor = kGrayTextColor; |
|
self.titleBottom.textAlignment = NSTextAlignmentCenter; |
|
self.titleBottom.textVerticalAlignment = YYTextVerticalAlignmentTop; |
|
self.titleBottom.font = kMainFont; |
|
[self.view addSubview:self.titleBottom]; |
|
|
|
|
|
self.boyButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
|
[self.boyButton setAdjustsImageWhenHighlighted:NO]; |
|
[self.boyButton setImage:[UIImage imageNamed:TFLocalizedString(@"insterest_boy_normal")] forState:UIControlStateNormal]; |
|
[self.boyButton addTarget:self action:@selector(boyButtonClick:) forControlEvents:UIControlEventTouchUpInside]; |
|
[self.view addSubview:self.boyButton]; |
|
|
|
|
|
self.girlButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
|
[self.girlButton setAdjustsImageWhenHighlighted:NO]; |
|
[self.girlButton setImage:[UIImage imageNamed:TFLocalizedString(@"insterest_girl_normal")] forState:UIControlStateNormal]; |
|
[self.girlButton addTarget:self action:@selector(girlButtonClick:) forControlEvents:UIControlEventTouchUpInside]; |
|
[self.view addSubview:self.girlButton]; |
|
|
|
|
|
self.nextStepButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
|
[self.nextStepButton setBackgroundColor:kColorRGBA(218, 218, 218, 1)]; |
|
[self.nextStepButton setTitleColor:kWhiteColor forState:UIControlStateNormal]; |
|
[self.nextStepButton.layer setCornerRadius:20]; |
|
[self.nextStepButton setUserInteractionEnabled:NO]; |
|
[self.nextStepButton setTitle:TFLocalizedString(@"确定") forState:UIControlStateNormal]; |
|
[self.nextStepButton addTarget:self action:@selector(nextStep) forControlEvents:UIControlEventTouchUpInside]; |
|
[self.view addSubview:self.nextStepButton]; |
|
} |
|
|
|
- (void)setupSubviewFrame |
|
{ |
|
[self.titleTop mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.top.mas_equalTo(PUB_NAVBAR_OFFSET); |
|
make.left.mas_equalTo(0); |
|
make.width.mas_equalTo(self.view.mas_width); |
|
make.height.mas_equalTo(65); |
|
}]; |
|
|
|
|
|
[self.titleBottom mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.top.mas_equalTo(self.titleTop.mas_bottom).with.offset(kHalfMargin); |
|
make.left.mas_equalTo(0); |
|
make.width.mas_equalTo(self.view.mas_width); |
|
make.height.mas_equalTo(self.titleTop.mas_height); |
|
}]; |
|
|
|
|
|
[self.boyButton mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.left.mas_equalTo(kMargin); |
|
make.top.mas_equalTo(self.titleBottom.mas_bottom).with.offset(4 * kMargin); |
|
make.width.height.mas_equalTo((SCREEN_WIDTH - 2 * kMargin) / 2); |
|
}]; |
|
|
|
|
|
[self.girlButton mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.right.mas_equalTo(self.view.mas_right).with.offset(- kMargin); |
|
make.top.mas_equalTo(self.titleBottom.mas_bottom).with.offset(4 * kMargin); |
|
make.width.height.mas_equalTo((SCREEN_WIDTH - 2 * kMargin) / 2); |
|
}]; |
|
|
|
|
|
[self.nextStepButton mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.bottom.mas_equalTo(self.view.mas_bottom).with.offset(- PUB_NAVBAR_OFFSET - kMargin); |
|
make.left.mas_equalTo(2 * kMargin); |
|
make.width.mas_equalTo(self.view.mas_width).with.offset(- 4 * kMargin); |
|
make.height.mas_equalTo(40); |
|
}]; |
|
} |
|
|
|
- (void)nextStep |
|
{ |
|
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Insterest_Change object:@"step_one"]; |
|
} |
|
|
|
- (void)boyButtonClick:(UIButton *)sender |
|
{ |
|
sender.selected = YES; |
|
|
|
[TFUserInfoManager shareInstance].gender = 2; |
|
|
|
self.girlButton.selected = NO; |
|
self.nextStepButton.backgroundColor = kMainColor; |
|
self.nextStepButton.userInteractionEnabled = YES; |
|
|
|
[self.girlButton setImage:[UIImage imageNamed:TFLocalizedString(@"insterest_girl_normal")] forState:UIControlStateNormal]; |
|
[self.boyButton setImage:[UIImage imageNamed:TFLocalizedString(@"insterest_boy_select")] forState:UIControlStateNormal]; |
|
|
|
TFSystemInfoManager.sexChannel = 1; |
|
TFSystemInfoManager.firstGenderSelecte = @"1"; |
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Channel_Change object:nil]; |
|
} |
|
|
|
- (void)girlButtonClick:(UIButton *)sender |
|
{ |
|
sender.selected = YES; |
|
|
|
[TFUserInfoManager shareInstance].gender = 1; |
|
|
|
self.boyButton.selected = NO; |
|
self.nextStepButton.backgroundColor = kMainColor; |
|
self.nextStepButton.userInteractionEnabled = YES; |
|
|
|
[self.girlButton setImage:[UIImage imageNamed:TFLocalizedString(@"insterest_girl_select")] forState:UIControlStateNormal]; |
|
[self.boyButton setImage:[UIImage imageNamed:TFLocalizedString(@"insterest_boy_normal")] forState:UIControlStateNormal]; |
|
|
|
TFSystemInfoManager.sexChannel = 2; |
|
TFSystemInfoManager.firstGenderSelecte = @"2"; |
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Channel_Change object:nil]; |
|
} |
|
|
|
@end
|
|
|