Skip to content

Instantly share code, notes, and snippets.

@aleciogomes
Created October 17, 2012 15:04
Show Gist options
  • Select an option

  • Save aleciogomes/3906032 to your computer and use it in GitHub Desktop.

Select an option

Save aleciogomes/3906032 to your computer and use it in GitHub Desktop.
UITableView animated update
// ...
@property (nonatomic) NSMutableArray* rowDescriptions;
// ...
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.rowDescriptions.count;
}
// ...
- (void)someAction {
// remove the element
[self.rowDescriptions removeObjectAtIndex:rowIndexToBeDeleted];
// update the tableView
NSArray *indexPaths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:rowIndexToBeDeleted inSection:0]];
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
[self.tableView endUpdates];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment