Skip to content

Instantly share code, notes, and snippets.

@bobspryn
Created February 10, 2014 23:43
Show Gist options
  • Select an option

  • Save bobspryn/8926541 to your computer and use it in GitHub Desktop.

Select an option

Save bobspryn/8926541 to your computer and use it in GitHub Desktop.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 1) {
static JotoTutorialTagsTableViewCell *sizingCell;
if (!sizingCell) {
sizingCell = [tableView dequeueReusableCellWithIdentifier:@"tutorialTagsCell"];
}
sizingCell.frame = CGRectMake(0, 0, self.tableView.frame.size.width, self.tableView.frame.size.height);
NSString *category = [self.interestArray objectAtIndex:indexPath.section];
NSArray *tags = [self tagsForCategory:category];
[sizingCell setTags:tags];
[sizingCell setNeedsLayout];
[sizingCell layoutIfNeeded];
CGFloat height = [sizingCell heightForTagsView];
//add 40px for next category button in all categories but last
if(indexPath.section < self.interestArray.count - 1)
return height + 80 + 40;
else
return height + 80;
}
return [super tableView:tableView heightForRowAtIndexPath:indexPath];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment