File tree Expand file tree Collapse file tree
Coding_iOS/Controllers/RootControllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,21 +236,10 @@ - (void)loadTasksLabels {
236236}
237237
238238- (void )configSegmentControlWithData : (Projects *)freshProjects {
239-
240- BOOL dataHasChanged = NO ;
241- for (Project *freshPro in freshProjects.list ) {
242- BOOL hasFreshPro = NO ;
243- for (Project *oldPro in self.myProjectList ) {
244- if (freshPro.id .integerValue == oldPro.id .integerValue ) {
245- hasFreshPro = YES ;
246- break ;
247- }
248- }
249- if (!hasFreshPro) {
250- dataHasChanged = YES ;
251- break ;
252- }
253- }
239+ NSMutableSet *oldProSet = [[NSSet alloc ] initWithArray: [self .myProjectList valueForKey: @" id" ]].mutableCopy ;
240+ NSMutableSet *freshProSet = [[NSSet alloc ] initWithArray: [freshProjects.list valueForKey: @" id" ]].mutableCopy ;
241+ [oldProSet removeObject: @(-1 )];// 代表「全部项目」的 id 号
242+ BOOL dataHasChanged = ![oldProSet isEqualToSet: freshProSet];
254243
255244 if (dataHasChanged) {
256245 self.myProjectList = [[NSMutableArray alloc ] initWithObjects: [Project project_All ], nil ];
You can’t perform that action at this time.
0 commit comments