Skip to content

Commit 59ad4b1

Browse files
committed
「我的任务」-「新建任务」时添加默认选择
1 parent e6c9c35 commit 59ad4b1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Coding_iOS/Controllers/RootControllers/MyTask_RootViewController.m

+7-4
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ - (void)viewDidLoad
6969
}];
7070
icarousel;
7171
});
72-
// [self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"addBtn_Nav"] style:UIBarButtonItemStylePlain target:self action:@selector(addItemClicked:)] animated:NO];
73-
7472
FRDLivelyButton *rightBtn = [[FRDLivelyButton alloc] initWithFrame:CGRectMake(0,0,18.5,18.5)];
7573

7674
[rightBtn setOptions:@{ kFRDLivelyButtonLineWidth: @(1.0f),
@@ -83,8 +81,13 @@ - (void)viewDidLoad
8381
}
8482

8583
- (void)addItemClicked:(id)sender{
86-
EditTaskViewController *vc = [[EditTaskViewController alloc] init];
87-
vc.myTask = [Task taskWithProject:nil andUser:nil];
84+
EditTaskViewController *vc = [EditTaskViewController new];
85+
86+
NSInteger curIndex = _myCarousel.currentItemIndex;
87+
Project *defaultPro = curIndex > 0? _myProjectList[curIndex]: nil;
88+
vc.myTask = [Task taskWithProject:defaultPro andUser:defaultPro? [Login curLoginUser]: nil];
89+
vc.myTask.handleType = TaskHandleTypeAddWithoutProject;
90+
8891
[self.navigationController pushViewController:vc animated:YES];
8992
}
9093

0 commit comments

Comments
 (0)