Skip to content

Commit 4a22ede

Browse files
committed
修改密码移动到里面+UI调整
1 parent 13492ac commit 4a22ede

4 files changed

Lines changed: 45 additions & 44 deletions

File tree

Coding_iOS/Controllers/MeSetting/SettingAccountViewController.m

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@
77
//
88

99
#define kCellIdentifier_TitleValue @"TitleValueCell"
10+
#define kCellIdentifier_TitleDisclosure @"TitleDisclosureCell"
1011

1112
#import "SettingAccountViewController.h"
1213
#import "TitleValueCell.h"
14+
#import "TitleDisclosureCell.h"
15+
16+
#import "SettingPasswordViewController.h"
17+
1318
@interface SettingAccountViewController ()
1419
@property (strong, nonatomic) UITableView *myTableView;
1520

@@ -43,31 +48,44 @@ - (void)loadView{
4348
tableView.delegate = self;
4449
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
4550
[tableView registerClass:[TitleValueCell class] forCellReuseIdentifier:kCellIdentifier_TitleValue];
51+
[tableView registerClass:[TitleDisclosureCell class] forCellReuseIdentifier:kCellIdentifier_TitleDisclosure];
4652
[self.view addSubview:tableView];
4753
tableView;
4854
});
4955
}
5056

5157
#pragma mark TableM
5258

59+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
60+
return 2;
61+
}
62+
5363
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
54-
NSInteger row = 2;
64+
NSInteger row = section == 0? 2: 1;
5565
return row;
5666
}
5767

5868
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
59-
TitleValueCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleValue forIndexPath:indexPath];
60-
61-
switch (indexPath.row) {
62-
case 0:
63-
[cell setTitleStr:@"邮箱" valueStr:self.myUser.email];
64-
break;
65-
default:
66-
[cell setTitleStr:@"个性后缀" valueStr:self.myUser.global_key];
67-
break;
69+
if (indexPath.section == 0) {
70+
TitleValueCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleValue forIndexPath:indexPath];
71+
72+
switch (indexPath.row) {
73+
case 0:
74+
[cell setTitleStr:@"邮箱" valueStr:self.myUser.email];
75+
break;
76+
default:
77+
[cell setTitleStr:@"个性后缀" valueStr:self.myUser.global_key];
78+
break;
79+
}
80+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
81+
return cell;
82+
}else{
83+
TitleDisclosureCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleDisclosure forIndexPath:indexPath];
84+
[cell setTitleStr:@"修改密码"];
85+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
86+
return cell;
6887
}
69-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
70-
return cell;
88+
7189
}
7290
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
7391
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 20)];
@@ -79,6 +97,11 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege
7997
}
8098
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
8199
[tableView deselectRowAtIndexPath:indexPath animated:YES];
100+
if (indexPath.section != 0) {
101+
SettingPasswordViewController *vc = [[SettingPasswordViewController alloc] init];
102+
vc.myUser = self.myUser;
103+
[self.navigationController pushViewController:vc animated:YES];
104+
}
82105
}
83106

84107
- (void)dealloc

Coding_iOS/Controllers/MeSetting/SettingPasswordViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
102102
}
103103
break;
104104
}
105-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
105+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
106106
return cell;
107107
}
108108
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

Coding_iOS/Controllers/MeSetting/SettingViewController.m

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#import "Login.h"
1313
#import "AppDelegate.h"
1414
#import "SettingAccountViewController.h"
15-
#import "SettingPasswordViewController.h"
1615
#import "AboutViewController.h"
1716
#import "FeedbackViewController.h"
1817

@@ -61,7 +60,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
6160
NSInteger row = 0;
6261
switch (section) {
6362
case 0:
64-
row = 2;
63+
row = 1;
6564
break;
6665
case 1:
6766
row = 2;
@@ -77,14 +76,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
7776
TitleDisclosureCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleDisclosure forIndexPath:indexPath];
7877
switch (indexPath.section) {
7978
case 0:
80-
switch (indexPath.row) {
81-
case 0:
82-
[cell setTitleStr:@"账号信息"];
83-
break;
84-
default:
85-
[cell setTitleStr:@"密码设置"];
86-
break;
87-
}
79+
[cell setTitleStr:@"账号设置"];
8880
break;
8981
case 1:
9082
switch (indexPath.row) {
@@ -103,7 +95,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
10395
[cell setTitleStr:@"关于Coding"];
10496
break;
10597
}
106-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
98+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
10799
return cell;
108100
}
109101
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
@@ -119,25 +111,11 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege
119111
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
120112
[tableView deselectRowAtIndexPath:indexPath animated:YES];
121113
switch (indexPath.section) {
122-
case 0:
123-
switch (indexPath.row) {
124-
case 0://账号信息
125-
{
126-
SettingAccountViewController *vc = [[SettingAccountViewController alloc] init];
127-
vc.myUser = self.myUser;
128-
[self.navigationController pushViewController:vc animated:YES];
129-
}
130-
break;
131-
case 1://密码设置
132-
{
133-
SettingPasswordViewController *vc = [[SettingPasswordViewController alloc] init];
134-
vc.myUser = self.myUser;
135-
[self.navigationController pushViewController:vc animated:YES];
136-
}
137-
break;
138-
default:
139-
break;
140-
}
114+
case 0:{//账号设置
115+
SettingAccountViewController *vc = [[SettingAccountViewController alloc] init];
116+
vc.myUser = self.myUser;
117+
[self.navigationController pushViewController:vc animated:YES];
118+
}
141119
break;
142120
case 1:
143121
switch (indexPath.row) {

Coding_iOS/Controllers/MeSetting/UserInfoViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
250250
[cell setTitleStr:@"个性标签" valueStr:_curUser.tags_str];
251251
break;
252252
}
253-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
253+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
254254
return cell;
255255
}
256256

0 commit comments

Comments
 (0)