美文网首页
9. iOS数组分组

9. iOS数组分组

作者: coder1003 | 来源:发表于2018-07-07 17:21 被阅读0次
    - (NSMutableArray *)sortPhoto:(NSArray *)dataArr {
    
     NSMutableArray *dataArray = [NSMutableArray array];
    
    [dataArr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
    
     SFAppointListModel *object = (SFAppointListModel *)obj;
    
     SFAppointListModel *group = ^SFAppointListModel *{
    
     for (SFAppointListModel *group in dataArray) {
    
     if ([group.dateStr isEqualToString:object.dateStr]) {
    
     return group;
    
                    }
    
                }
    
     return nil;
    
            }();
    
     if (group == nil) {
    
    [dataArray addObject:object];
    
            }
    
     else {
    
    [group.bookResultDtos addObjectsFromArray:object.bookResultDtos];
    
            }
    
        }];
    
     return dataArray;
    
    }
    

    相关文章

      网友评论

          本文标题:9. iOS数组分组

          本文链接:https://www.haomeiwen.com/subject/gvlguftx.html