Skip to content

Instantly share code, notes, and snippets.

@madsleejensen
Created February 15, 2016 17:09
Show Gist options
  • Save madsleejensen/2dc85cc546ec5b046e7b to your computer and use it in GitHub Desktop.
Save madsleejensen/2dc85cc546ec5b046e7b to your computer and use it in GitHub Desktop.
UITableView - Animate Cells In
- (void)animateIn {
// animate in from the sides
NSArray *visibleCells = [self visibleCells];
for (NSUInteger index = 0; index < visibleCells.count; index++) {
CGFloat delay = (index * 0.04f) + 0.3f;
UITableViewCell *cell = visibleCells[index];
cell.transform = CGAffineTransformMakeTranslation([UIScreen mainScreen].bounds.size.width - 120.0f, 0);
cell.alpha = 0.0f;
[UIView animateWithDuration:0.9f delay:delay usingSpringWithDamping:0.8f initialSpringVelocity:0.1f options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction animations:^{
cell.transform = CGAffineTransformIdentity;
cell.alpha = 1.0f;
} completion:nil];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment