Skip to content

Instantly share code, notes, and snippets.

@tdhop
Last active March 28, 2017 13:22
Show Gist options
  • Save tdhop/5846707 to your computer and use it in GitHub Desktop.
Save tdhop/5846707 to your computer and use it in GitHub Desktop.
Simple method for creating expanding UITableView rows that expand in an animated fashion when accessory button is tapped. What you do with the extra space in the expanded row is up to you.
- (void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Detail Disclosure Tapped");
// Set expanded cell then tell tableView to redraw with animation
self.expandedRow = indexPath;
[self.tableView beginUpdates];
[self.tableView endUpdates];
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([indexPath isEqual:self.expandedRow]) {
return EXPANDED_HEIGHT;
}
return NORMAL_HEIGHT;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment