Skip to content

Instantly share code, notes, and snippets.

@TimothyChilvers
Created October 26, 2015 16:07
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 TimothyChilvers/3e7c9fa756fac8b3a486 to your computer and use it in GitHub Desktop.
Save TimothyChilvers/3e7c9fa756fac8b3a486 to your computer and use it in GitHub Desktop.
- (void)moveStuff {
CGRect originalFrame = self.moveMe.frame;
CGAffineTransform firstTransform = CGAffineTransformMake(0, 1, -1, 0, -50, -50);
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.moveMe.transform = firstTransform;
} completion:^(BOOL finished) {
CGRect stashFrame = self.moveMe.frame;
self.moveMe.transform = CGAffineTransformIdentity;
self.moveMe.frame = stashFrame;
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
CGAffineTransform secondTransform = CGAffineTransformMakeTranslation(0, 50);
self.moveMe.transform = secondTransform;
} completion:^(BOOL finished) {
self.moveMe.transform = CGAffineTransformIdentity;
self.moveMe.frame = originalFrame;
}];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment