Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 16f8550

Browse files
标签管理的 bug - 任务 | 讨论
1 parent 30648ca commit 16f8550

File tree

7 files changed

+45
-43
lines changed

7 files changed

+45
-43
lines changed

‎Coding_iOS/Coding_iOS-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</dict>
3737
</array>
3838
<key>CFBundleVersion</key>
39-
<string>3.8.201602231730</string>
39+
<string>3.8.201602251530</string>
4040
<key>LSApplicationQueriesSchemes</key>
4141
<array>
4242
<string>wechat</string>

‎Coding_iOS/Controllers/EditLabelViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
@property (strong, nonatomic) NSArray *orignalTags;
1515
@property (strong, nonatomic) Project *curProject;
1616

17-
@property (copy, nonatomic) void(^tagsChangedBlock)(EditLabelViewController *vc, NSMutableArray *selectedTags);
17+
@property (copy, nonatomic) void(^tagsSelectedBlock)(EditLabelViewController *vc, NSMutableArray *selectedTags);
1818

1919
@end

‎Coding_iOS/Controllers/EditLabelViewController.m

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ - (void)viewWillAppear:(BOOL)animated
7878
[self.myTableView reloadData];
7979
}
8080

81+
- (void)viewWillDisappear:(BOOL)animated{
82+
[super viewWillDisappear:YES];
83+
if (_tagList.count > 0 && _selectedTags.count > 0) {
84+
for (ProjectTag *tag in _tagList) {
85+
ProjectTag *orignalTag = [ProjectTag tags:_selectedTags hasTag:tag];
86+
if (orignalTag) {
87+
[_selectedTags replaceObjectAtIndex:[_selectedTags indexOfObject:orignalTag] withObject:tag];
88+
}
89+
}
90+
}
91+
if (_tagsSelectedBlock) {
92+
_tagsSelectedBlock(self, _selectedTags);
93+
}
94+
}
95+
8196
- (void)sendRequest
8297
{
8398
[self.view beginLoading];
@@ -88,15 +103,11 @@ - (void)sendRequest
88103
weakSelf.tagList = data;
89104
[weakSelf.myTableView reloadData];
90105
}
91-
}];
92-
}
106+
}];}
93107

94108
#pragma mark - click
95-
- (void)okBtnClick
96-
{
97-
if (self.tagsChangedBlock) {
98-
self.tagsChangedBlock(self, _selectedTags);
99-
}
109+
- (void)okBtnClick{
110+
[self.navigationController popViewControllerAnimated:YES];
100111
}
101112

102113
- (void)addBtnClick:(UIButton *)sender

‎Coding_iOS/Controllers/EditTaskViewController.m

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -571,39 +571,32 @@ - (void)goToTagsVC{
571571
vc.curProject = self.myCopyTask.project;
572572
vc.orignalTags = self.myCopyTask.labels;
573573
@weakify(self);
574-
vc.tagsChangedBlock = ^(EditLabelViewController *vc, NSMutableArray *selectedTags){
574+
vc.tagsSelectedBlock = ^(EditLabelViewController *vc, NSMutableArray *selectedTags){
575575
@strongify(self);
576576
[self tagsHasChanged:selectedTags fromVC:vc];
577577
};
578578
[self.navigationController pushViewController:vc animated:YES];
579579
}
580580

581581
- (void)tagsHasChanged:(NSMutableArray *)selectedTags fromVC:(EditLabelViewController *)vc{
582-
if ([ProjectTag tags:self.myCopyTask.labels isEqualTo:selectedTags]) {
583-
[vc.navigationController popViewControllerAnimated:YES];
582+
if ([ProjectTag tags:self.myCopyTask.labels isEqualTo:self.myTask.labels] || self.myCopyTask.handleType > TaskHandleTypeEdit) {
583+
self.myTask.labels = [selectedTags mutableCopy];
584+
self.myCopyTask.labels = [selectedTags mutableCopy];
585+
[self.myTableView reloadData];
584586
}else{
585-
if (self.myCopyTask.handleType > TaskHandleTypeEdit) {
586-
self.myCopyTask.labels = selectedTags;
587-
self.myTask.labels = [self.myCopyTask.labels mutableCopy];
588-
[self.myTableView reloadData];
589-
[vc.navigationController popViewControllerAnimated:YES];
590-
}else{
591-
vc.navigationItem.rightBarButtonItem.enabled = NO;
592-
@weakify(self);
593-
[[Coding_NetAPIManager sharedManager] request_EditTask:_myCopyTask withTags:selectedTags andBlock:^(id data, NSError *error) {
594-
@strongify(self);
595-
vc.navigationItem.rightBarButtonItem.enabled = YES;
596-
if (data) {
597-
self.myCopyTask.labels = selectedTags;
598-
self.myTask.labels = [self.myCopyTask.labels mutableCopy];
599-
[self.myTableView reloadData];
600-
if (self.taskChangedBlock) {
601-
self.taskChangedBlock();
602-
}
603-
[vc.navigationController popViewControllerAnimated:YES];
587+
@weakify(self);
588+
[[Coding_NetAPIManager sharedManager] request_EditTask:_myCopyTask withTags:selectedTags andBlock:^(id data, NSError *error) {
589+
@strongify(self);
590+
if (data) {
591+
self.myCopyTask.labels = [selectedTags mutableCopy];
592+
self.myTask.labels = [selectedTags mutableCopy];
593+
[self.myTableView reloadData];
594+
if (self.taskChangedBlock) {
595+
self.taskChangedBlock();
604596
}
605-
}];
606-
}
597+
}
598+
}];
599+
607600
}
608601
}
609602

‎Coding_iOS/Controllers/EditTopicViewController.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,9 @@ - (void)addtitleBtnClick
282282
vc.curProject = _curProTopic.project;
283283
vc.orignalTags = _curProTopic.mdLabels;
284284
@weakify(self);
285-
vc.tagsChangedBlock = ^(EditLabelViewController *vc, NSMutableArray *selectedTags){
285+
vc.tagsSelectedBlock = ^(EditLabelViewController *vc, NSMutableArray *selectedTags){
286286
@strongify(self);
287287
self.curProTopic.mdLabels = selectedTags;
288-
[vc.navigationController popViewControllerAnimated:YES];
289288
};
290289
[self.navigationController pushViewController:vc animated:YES];
291290
}

‎Coding_iOS/Controllers/ResetLabelViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ - (void)viewDidLoad {
4848
}];
4949
tableView;
5050
});
51+
_tempStr = _ptLabel.name;
5152
}
5253

5354
- (void)viewWillAppear:(BOOL)animated{
5455
[super viewWillAppear:animated];
55-
_tempStr = _ptLabel.name;
5656
[_myTableView reloadData];
5757
}
5858

@@ -105,7 +105,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
105105
[cell.labelField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
106106
[cell.colorBtn addTarget:self action:@selector(colorBtnClick:) forControlEvents:UIControlEventTouchUpInside];
107107
cell.backgroundColor = kColorTableBG;
108-
cell.labelField.text = _ptLabel.name;
108+
cell.labelField.text = _tempStr;
109109
cell.colorBtn.backgroundColor = [UIColor colorWithHexString:[_ptLabel.color stringByReplacingOccurrencesOfString:@"#" withString:@"0x"]];
110110
return cell;
111111
}

‎Coding_iOS/Controllers/TopicDetailViewController.m

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,27 +135,26 @@ - (void)addtitleBtnClick
135135
vc.curProject = self.curTopic.project;
136136
vc.orignalTags = self.curTopic.mdLabels;
137137
@weakify(self);
138-
vc.tagsChangedBlock = ^(EditLabelViewController *vc, NSMutableArray *selectedTags){
138+
vc.tagsSelectedBlock = ^(EditLabelViewController *vc, NSMutableArray *selectedTags){
139139
@strongify(self);
140140
[self tagsHasChanged:selectedTags fromVC:vc];
141141
};
142142
[self.navigationController pushViewController:vc animated:YES];
143143
}
144144

145145
- (void)tagsHasChanged:(NSMutableArray *)selectedTags fromVC:(EditLabelViewController *)vc{
146-
self.curTopic.mdLabels = selectedTags;
147146
if ([ProjectTag tags:self.curTopic.mdLabels isEqualTo:self.curTopic.labels]) {
148-
[vc.navigationController popViewControllerAnimated:YES];
147+
self.curTopic.mdLabels = [selectedTags mutableCopy];
148+
self.curTopic.labels = [selectedTags mutableCopy];
149+
[self.myTableView reloadData];
149150
}else{
150-
vc.navigationItem.rightBarButtonItem.enabled = NO;
151151
@weakify(self);
152152
[[Coding_NetAPIManager sharedManager] request_ModifyProjectTpoicLabel:self.curTopic andBlock:^(id data, NSError *error) {
153153
@strongify(self);
154-
vc.navigationItem.rightBarButtonItem.enabled = YES;
155154
if (data) {
155+
self.curTopic.mdLabels = [selectedTags mutableCopy];
156156
self.curTopic.labels = [self.curTopic.mdLabels mutableCopy];
157157
[self.myTableView reloadData];
158-
[vc.navigationController popViewControllerAnimated:YES];
159158
}
160159
}];
161160
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /