Skip to content

Instantly share code, notes, and snippets.

@muukii
Created February 10, 2014 09:40
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save muukii/8913034 to your computer and use it in GitHub Desktop.
Save muukii/8913034 to your computer and use it in GitHub Desktop.
UIView bounce Animation
- (void)bounceAnimation:(void (^)())completion
{
CGRect rect = self.frame;
CGRect insetRect = CGRectInset(rect, 10, 10);
self.frame = insetRect;
[UIView animateWithDuration:1 delay:0 usingSpringWithDamping:0.4 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.frame = rect;
} completion:^(BOOL finished) {
if (completion) {
completion();
}
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment