I think an array of arrays would work better for you, where each array represents a section. allGroups should then contain 3 arrays. Then you need to override the datasource method:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return self.allGroups.count;
}
and then in:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.allGroups[section];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *group = self.allGroups[indexPath.section];
NSDictionary *groupInfo = group[indexPath.row];
static NSString *cellIdentifier = @"Cell";
groupTableViewCell *cell = (groupTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[groupTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
cell.groupTitle.text= groupInfo[@"title"];
cell.groupLikes.text= [NSString stringWithFormat:@"%@", groupInfo[@"likes"]];
cell.groupRunDates.text= [NSString stringWithFormat:@"%@ - %@", groupInfo[@"start_date"], groupInfo[@"end_date"]];
cell.groupAcceptance.text= groupInfo[@"acceptance_type"];
return cell;
}