Created
July 18, 2012 21:47
-
-
Save BenBarahona/3139147 to your computer and use it in GitHub Desktop.
Bounce & Shrink View
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
//BOUNCE ANIMATION | |
-(void)beginBounceAnimation { | |
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001); | |
self.view.alpha = 1.0; | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:0.25]; | |
[UIView setAnimationDelegate:self]; | |
[UIView setAnimationDidStopSelector:@selector(bounce1AnimationStopped)]; | |
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1); | |
[UIView commitAnimations]; | |
} | |
- (void)bounce1AnimationStopped { | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:0.25 / 2]; | |
[UIView setAnimationDelegate:self]; | |
[UIView setAnimationDidStopSelector:@selector(bounce2AnimationStopped)]; | |
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9); | |
[UIView commitAnimations]; | |
} | |
- (void)bounce2AnimationStopped { | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:0.25 / 2]; | |
self.view.transform = CGAffineTransformIdentity; | |
[UIView commitAnimations]; | |
} | |
//SHRINK ANIMATIONS | |
-(void)shrinkView { | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:0.25 / 2]; | |
[UIView setAnimationDelegate:self]; | |
[UIView setAnimationDidStopSelector:@selector(shrink1AnimationStopped)]; | |
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1); | |
[UIView commitAnimations]; | |
} | |
- (void)shrink1AnimationStopped { | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:0.25]; | |
[UIView setAnimationDelegate:self]; | |
[UIView setAnimationDidStopSelector:@selector(shrink2AnimationStopped)]; | |
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001); | |
[UIView commitAnimations]; | |
} | |
-(void)shrink2AnimationStopped { | |
//Remove the view from superview | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment