Created
February 15, 2016 17:09
-
-
Save madsleejensen/2dc85cc546ec5b046e7b to your computer and use it in GitHub Desktop.
UITableView - Animate Cells In
This file contains 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
- (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