Skip to content

Instantly share code, notes, and snippets.

@marcpalmer
Created August 27, 2014 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcpalmer/6eb3b6c6e9cef5fd0a8a to your computer and use it in GitHub Desktop.
Save marcpalmer/6eb3b6c6e9cef5fd0a8a to your computer and use it in GitHub Desktop.
BOOL hasCurrentAnimations = [self.myLabel.layer animationKeys].count;
if (rising) {
[self.currentTimeLabel.layer removeAllAnimations];
[UIView animateWithDuration:5.0f delay:0.0f
options:(hasCurrentAnimations ? UIViewAnimationOptionBeginFromCurrentState : 0) animations:^{
self.myLabel.center = CGPointMake(self.myLabel.center.x, self.otherButton.center.y);
} completion:nil];
} else {
[self.currentTimeLabel.layer removeAllAnimations];
[UIView animateWithDuration:5.0f delay:0.0f
options:(hasCurrentTransformAnimation ? UIViewAnimationOptionBeginFromCurrentState : 0) animations:^{
self.myLabel.center = CGPointMake(self.myLabel.center.x, originalLabelY);
} completion:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment