[iOS] UITableView Cell 변경 animation
NSMutableSet *_selectedIndexPaths;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([_selectedIndexPaths containsObject:indexPath]) {
[_selectedIndexPaths removeObject:indexPath];
} else {
[_selectedIndexPaths addObject:indexPath];
}
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionLayoutSubviews
animations:^{
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
}
completion:NULL];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
CGFloat height = 68.0f;
if ([_selectedIndexPaths containsObject:indexPath]) {
height *= 2.0f;
}
return height;
}