Skip to content

Commit 6880b51

Browse files
committed
调整 UI
1 parent 7f9f865 commit 6880b51

3 files changed

Lines changed: 58 additions & 30 deletions

File tree

Coding_iOS/Controllers/Login/LoginViewController.m

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ @interface LoginViewController ()
2929

3030

3131
@property (assign, nonatomic) BOOL captchaNeeded;
32-
@property (strong, nonatomic) UIButton *loginBtn;
32+
@property (strong, nonatomic) UIButton *loginBtn, *buttonFor2FA;
3333
@property (strong, nonatomic) UIActivityIndicatorView *activityIndicator;
3434
@property (strong, nonatomic) UIImageView *iconUserView, *bgBlurredView;
3535
@property (strong, nonatomic) EaseInputTipsView *inputTipsView;
@@ -76,12 +76,30 @@ - (void)viewDidLoad
7676
tableView;
7777
});
7878

79-
8079
self.myTableView.contentInset = UIEdgeInsetsMake(-kHigher_iOS_6_1_DIS(20), 0, 0, 0);
8180
self.myTableView.tableHeaderView = [self customHeaderView];
8281
self.myTableView.tableFooterView=[self customFooterView];
8382
[self configBottomView];
8483
[self showdismissButton:self.showDismissButton];
84+
[self buttonFor2FA];
85+
}
86+
87+
- (UIButton *)buttonFor2FA{
88+
if (!_buttonFor2FA) {
89+
_buttonFor2FA = ({
90+
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(kScreen_Width - 80, 20, 60, 50)];
91+
[button.titleLabel setFont:[UIFont systemFontOfSize:14]];
92+
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
93+
[button setTitleColor:[UIColor colorWithWhite:1.0 alpha:0.5] forState:UIControlStateHighlighted];
94+
95+
[button setTitle:@" 2FA" forState:UIControlStateNormal];
96+
[button setImage:[UIImage imageNamed:@"convenient_2FA"] forState:UIControlStateNormal];
97+
button;
98+
});
99+
[_buttonFor2FA addTarget:self action:@selector(goTo2FAVC) forControlEvents:UIControlEventTouchUpInside];
100+
[self.view addSubview:_buttonFor2FA];
101+
}
102+
return _buttonFor2FA;
85103
}
86104

87105
- (void)setCaptchaNeeded:(BOOL)captchaNeeded{
@@ -271,11 +289,14 @@ - (UIView *)customHeaderView{
271289
}
272290

273291
- (UIView *)customFooterView{
274-
UIView *footerV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 100)];
292+
UIView *footerV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 150)];
275293
_loginBtn = [UIButton buttonWithStyle:StrapSuccessStyle andTitle:@"登录" andFrame:CGRectMake(kLoginPaddingLeftWidth, 20, kScreen_Width-kLoginPaddingLeftWidth*2, 45) target:self action:@selector(sendLogin)];
276294
[footerV addSubview:_loginBtn];
277295

278296

297+
298+
299+
279300
RAC(self, loginBtn.enabled) = [RACSignal combineLatest:@[
280301
RACObserve(self, myLogin.email),
281302
RACObserve(self, myLogin.password),
@@ -301,6 +322,24 @@ - (UIView *)customFooterView{
301322
}
302323
}
303324
}];
325+
326+
UIButton *cannotLoginBtn = ({
327+
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
328+
[button.titleLabel setFont:[UIFont systemFontOfSize:14]];
329+
[button setTitleColor:[UIColor colorWithWhite:1.0 alpha:0.5] forState:UIControlStateNormal];
330+
[button setTitleColor:[UIColor colorWithWhite:0.5 alpha:0.5] forState:UIControlStateHighlighted];
331+
332+
[button setTitle:@"无法登录?" forState:UIControlStateNormal];
333+
[footerV addSubview:button];
334+
[button mas_makeConstraints:^(MASConstraintMaker *make) {
335+
make.size.mas_equalTo(CGSizeMake(100, 30));
336+
make.centerX.equalTo(footerV);
337+
make.top.equalTo(_loginBtn.mas_bottom).offset(20);
338+
}];
339+
button;
340+
});
341+
[cannotLoginBtn addTarget:self action:@selector(cannotLoginBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
342+
304343
return footerV;
305344
}
306345

@@ -315,44 +354,22 @@ - (void)configBottomView{
315354
[button setTitleColor:[UIColor colorWithWhite:1.0 alpha:0.5] forState:UIControlStateNormal];
316355
[button setTitleColor:[UIColor colorWithWhite:0.5 alpha:0.5] forState:UIControlStateHighlighted];
317356

318-
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
319-
[button setTitle:@"新用户" forState:UIControlStateNormal];
357+
[button setTitle:@"去注册" forState:UIControlStateNormal];
320358
[_bottomView addSubview:button];
321359
[button mas_makeConstraints:^(MASConstraintMaker *make) {
322360
make.size.mas_equalTo(CGSizeMake(100, 300));
323-
make.centerY.equalTo(_bottomView);
324-
make.right.equalTo(_bottomView).offset(-kLoginPaddingLeftWidth);
361+
make.center.equalTo(_bottomView);
325362
}];
326363
button;
327364
});
328-
329-
UIButton *cannotLoginBtn = ({
330-
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
331-
[button.titleLabel setFont:[UIFont systemFontOfSize:14]];
332-
[button setTitleColor:[UIColor colorWithWhite:1.0 alpha:0.5] forState:UIControlStateNormal];
333-
[button setTitleColor:[UIColor colorWithWhite:0.5 alpha:0.5] forState:UIControlStateHighlighted];
334-
335-
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
336-
[button setTitle:@"无法登录?" forState:UIControlStateNormal];
337-
[_bottomView addSubview:button];
338-
[button mas_makeConstraints:^(MASConstraintMaker *make) {
339-
make.size.mas_equalTo(CGSizeMake(100, 300));
340-
make.centerY.equalTo(_bottomView);
341-
make.left.equalTo(_bottomView).offset(kLoginPaddingLeftWidth);
342-
}];
343-
button;
344-
});
345-
346365
[registerBtn addTarget:self action:@selector(goRegisterVC:) forControlEvents:UIControlEventTouchUpInside];
347-
[cannotLoginBtn addTarget:self action:@selector(cannotLoginBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
348-
349366
[self.view addSubview:_bottomView];
350367
}
351368
}
352369

353370
#pragma mark Btn Clicked
354371
- (void)sendLogin{
355-
NSString *tipMsg = self.is2FAUI? [self goToLoginTipWith2FA]: [_myLogin goToLoginTipWithCaptcha:_captchaNeeded];
372+
NSString *tipMsg = self.is2FAUI? [self loginTipFor2FA]: [_myLogin goToLoginTipWithCaptcha:_captchaNeeded];
356373
if (tipMsg) {
357374
kTipAlert(@"%@", tipMsg);
358375
return;
@@ -452,7 +469,7 @@ - (void)setIs2FAUI:(BOOL)is2FAUI{
452469
[self.myTableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:_is2FAUI? UITableViewRowAnimationLeft: UITableViewRowAnimationRight];
453470
}
454471

455-
- (NSString *)goToLoginTipWith2FA{
472+
- (NSString *)loginTipFor2FA{
456473
NSString *tipStr = nil;
457474
if (self.otpCode.length <= 0) {
458475
tipStr = @"动态验证码不能为空";
@@ -461,4 +478,9 @@ - (NSString *)goToLoginTipWith2FA{
461478
}
462479
return tipStr;
463480
}
481+
482+
- (void)goTo2FAVC{
483+
OTPListViewController *vc = [OTPListViewController new];
484+
[self.navigationController pushViewController:vc animated:YES];
485+
}
464486
@end

Coding_iOS/Ease_2FA/Controllers/OTPListViewController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ - (void)viewDidLoad{
8585

8686
- (void)viewWillAppear:(BOOL)animated{
8787
[super viewWillAppear:animated];
88+
[self.navigationController setNavigationBarHidden:NO animated:YES];
8889
[self configUI];
8990
}
9091

@@ -142,6 +143,11 @@ - (void)configUI{
142143
if (!_beginButton) {
143144
_beginButton = [UIButton buttonWithStyle:StrapSuccessStyle andTitle:@"开始验证" andFrame:CGRectMake(kPaddingLeftWidth, CGRectGetHeight(self.view.frame)- 20 - 45, kScreen_Width-kPaddingLeftWidth*2, 45) target:self action:@selector(beginButtonClicked:)];
144145
[self.view addSubview:_beginButton];
146+
[_beginButton mas_makeConstraints:^(MASConstraintMaker *make) {
147+
make.size.mas_equalTo(CGSizeMake(kScreen_Width-kPaddingLeftWidth*2, 45));
148+
make.centerX.equalTo(self.view);
149+
make.bottom.equalTo(self.view).offset(-20);
150+
}];
145151
}
146152
CGSize tipImageSize = tipImage.size;
147153
CGFloat scale = 1.0;

Coding_iOS/Views/Cell/Login2FATipCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
2121
_tipLabel.layer.masksToBounds = YES;
2222
_tipLabel.layer.cornerRadius = 2.0;
2323

24-
_tipLabel.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.5];
24+
_tipLabel.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.2];
2525
_tipLabel.font = [UIFont systemFontOfSize:16];
2626
_tipLabel.minimumScaleFactor = 0.5;
2727
_tipLabel.adjustsFontSizeToFitWidth = YES;

0 commit comments

Comments
 (0)