Last active
August 29, 2015 14:02
-
-
Save betzerra/68957450ed5d6e9dd912 to your computer and use it in GitHub Desktop.
Spring animation using iOS 7
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
// Set startFrame and endFrame for _contentView | |
CGRect endFrame = _contentView.frame; | |
CGRect startFrame = endFrame; | |
startFrame.origin.y = -startFrame.size.height; | |
_contentView.frame = startFrame; | |
void (^animationBlock)(void) = ^(void){ | |
_contentView.frame = endFrame; | |
}; | |
/* usingSprintWithDamping: value between 0 and 1. | |
* Employ a damping ratio closer to zero to | |
* increase oscillation. | |
* | |
* initialSpringVelocity: a value of 1 corresponds | |
* to the total animation distance traversed in one | |
* second. The higher its value, the faster its initial | |
* speed. */ | |
[UIView animateWithDuration:1.0 | |
delay:0.15 | |
usingSpringWithDamping:0.6 | |
initialSpringVelocity:7 | |
options:0 | |
animations:animationBlock | |
completion:nil]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment