Skip to content

Instantly share code, notes, and snippets.

@leviathan
Created December 5, 2013 07:29
Show Gist options
  • Save leviathan/7801501 to your computer and use it in GitHub Desktop.
Save leviathan/7801501 to your computer and use it in GitHub Desktop.
UITableViewCell scaling animation
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// setup initial state (e.g. before animation)
cell.layer.shadowColor = [[UIColor blackColor] CGColor];
cell.layer.shadowOffset = CGSizeMake(10, 10);
cell.alpha = 0;
cell.layer.transform = CATransform3DMakeScale(0.5, 0.5, 0.5);
cell.layer.anchorPoint = CGPointMake(0, 0.5);
// define final state (e.g. after animation) & commit animation
[UIView beginAnimations:@"scaleTableViewCellAnimationID" context:NULL];
[UIView setAnimationDuration:0.7];
cell.layer.shadowOffset = CGSizeMake(0, 0);
cell.alpha = 1;
cell.layer.transform = CATransform3DIdentity;
[UIView commitAnimations];
}
@cloudjanak
Copy link

Problem in Swift

@cloudjanak
Copy link

simulator screen shot 13-oct-2015 5 50 49 pm
This is issue

@sousaleonardo
Copy link

Hi, try remove cell.layer.anchorPoint = CGPointMake(0, 0.5);

This bug occurred with me some times, and after I remove this line it doesn't appear anymore

@EvelinJebin
Copy link

EvelinJebin commented Aug 16, 2016

The above code working fine. thanks

@nehasharma1101
Copy link

Animate two time first time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment