Last active
March 28, 2017 13:22
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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