Created
October 17, 2012 15:04
-
-
Save aleciogomes/3906032 to your computer and use it in GitHub Desktop.
UITableView animated update
This file contains hidden or 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
| // ... | |
| @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