登录注册改改改 · CoderKman/Coding-iOS@b318bfe · GitHub
Skip to content

Commit b318bfe

Browse files
committed
登录注册改改改
1 parent 1bedeed commit b318bfe

19 files changed

Lines changed: 467 additions & 496 deletions

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 30 additions & 0 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// ActivateViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 16/2/18.
6+
// Copyright © 2016年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
11+
@interface ActivateViewController : BaseViewController
12+
13+
@end
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
//
2+
// ActivateViewController.m
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 16/2/18.
6+
// Copyright © 2016年 Coding. All rights reserved.
7+
//
8+
9+
#import "ActivateViewController.h"
10+
#import "Input_OnlyText_Cell.h"
11+
#import "TPKeyboardAvoidingTableView.h"
12+
#import "Coding_NetAPIManager.h"
13+
#import "AppDelegate.h"
14+
15+
@interface ActivateViewController ()<UITableViewDataSource, UITableViewDelegate>
16+
@property (strong, nonatomic) TPKeyboardAvoidingTableView *myTableView;
17+
@property (strong, nonatomic) UIButton *footerBtn;
18+
@property (strong, nonatomic) NSString *global_key;
19+
@end
20+
21+
@implementation ActivateViewController
22+
23+
- (void)viewDidLoad {
24+
[super viewDidLoad];
25+
// Do any additional setup after loading the view.
26+
self.title = @"设置用户名";
27+
// 添加myTableView
28+
_myTableView = ({
29+
TPKeyboardAvoidingTableView *tableView = [[TPKeyboardAvoidingTableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
30+
[tableView registerClass:[Input_OnlyText_Cell class] forCellReuseIdentifier:kCellIdentifier_Input_OnlyText_Cell_Text];
31+
tableView.backgroundColor = kColorTableSectionBg;
32+
tableView.dataSource = self;
33+
tableView.delegate = self;
34+
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
35+
[self.view addSubview:tableView];
36+
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
37+
make.edges.equalTo(self.view);
38+
}];
39+
tableView;
40+
});
41+
self.myTableView.tableHeaderView = [self customHeaderView];
42+
self.myTableView.tableFooterView=[self customFooterView];
43+
}
44+
- (void)viewWillAppear:(BOOL)animated{
45+
[super viewWillAppear:animated];
46+
[self.navigationController setNavigationBarHidden:NO animated:YES];
47+
}
48+
49+
- (UIView *)customHeaderView{
50+
UIView *headerV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 60)];
51+
headerV.backgroundColor = [UIColor clearColor];
52+
UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 50)];
53+
headerLabel.backgroundColor = [UIColor clearColor];
54+
headerLabel.font = [UIFont boldSystemFontOfSize:12];
55+
headerLabel.textColor = [UIColor colorWithHexString:@"0x999999"];
56+
headerLabel.numberOfLines = 0;
57+
headerLabel.textAlignment = NSTextAlignmentCenter;
58+
headerLabel.text = @"您还未设置过用户名(个性后缀)\n设置后才能正常登录!";
59+
[headerLabel setCenter:headerV.center];
60+
[headerV addSubview:headerLabel];
61+
return headerV;
62+
}
63+
- (UIView *)customFooterView{
64+
UIView *footerV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 150)];
65+
//button
66+
_footerBtn = [UIButton buttonWithStyle:StrapSuccessStyle andTitle:@"马上设置" andFrame:CGRectMake(kLoginPaddingLeftWidth, 20, kScreen_Width-kLoginPaddingLeftWidth*2, 45) target:self action:@selector(sendActivate)];
67+
[footerV addSubview:_footerBtn];
68+
RAC(self, footerBtn.enabled) = [RACSignal combineLatest:@[RACObserve(self, global_key)] reduce:^id(NSString *global_key){
69+
return @(global_key.length > 0);
70+
}];
71+
return footerV;
72+
}
73+
74+
- (void)sendActivate{
75+
[self.footerBtn startQueryAnimate];
76+
[[Coding_NetAPIManager sharedManager] request_ActivateBySetGlobal_key:_global_key block:^(id data, NSError *error) {
77+
[self.footerBtn stopQueryAnimate];
78+
if (data) {
79+
[Login setPreUserEmail:self.global_key];//记住登录账号
80+
[((AppDelegate *)[UIApplication sharedApplication].delegate) setupTabViewController];
81+
}
82+
}];
83+
}
84+
#pragma matk Table
85+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
86+
return 1;
87+
}
88+
89+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
90+
Input_OnlyText_Cell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_Input_OnlyText_Cell_Text forIndexPath:indexPath];
91+
__weak typeof(self) weakSelf = self;
92+
[cell setPlaceholder:@" 用户名(个性后缀)" value:self.global_key];
93+
cell.textValueChangedBlock = ^(NSString *valueStr){
94+
weakSelf.global_key = valueStr;
95+
};
96+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kLoginPaddingLeftWidth];
97+
return cell;
98+
}
99+
100+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
101+
return 44.0;
102+
}
103+
@end

Coding_iOS/Controllers/Login/CannotLoginViewController.h

Lines changed: 2 additions & 1 deletion

0 commit comments

Comments
 (0)