File tree 1 file changed +4
-15
lines changed
Coding_iOS/Controllers/RootControllers 1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -236,21 +236,10 @@ - (void)loadTasksLabels {
236
236
}
237
237
238
238
- (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];
254
243
255
244
if (dataHasChanged) {
256
245
self.myProjectList = [[NSMutableArray alloc ] initWithObjects: [Project project_All ], nil ];
You can’t perform that action at this time.
0 commit comments