Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mlabraca/5c1932fabad3e8af9dde to your computer and use it in GitHub Desktop.
Save mlabraca/5c1932fabad3e8af9dde to your computer and use it in GitHub Desktop.
For a given view, applies horizontal movement for offset and duration.
- (void) moveViewHorizontally:(UIView *)view duration:(float)duration forOffset:(float)offset
{
[UIView animateWithDuration:duration
delay:0.0
options: UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse
animations:^{
view.center = CGPointMake(view.center.x + offset, view.center.y);
}
completion:NULL];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment