Skip to content

Instantly share code, notes, and snippets.

@tolmasky
Created July 22, 2011 01:04
Show Gist options
  • Select an option

  • Save tolmasky/1098618 to your computer and use it in GitHub Desktop.

Select an option

Save tolmasky/1098618 to your computer and use it in GitHub Desktop.
UIImageView * imageView = (UIImageView *)aGestureRecognizer.view;
draggedView = [[UIImageView alloc] initWithImage:[imageView image]];
UIWindow * window = [self.view window];
BOOL areEnabled = [UIView areAnimationsEnabled];
[UIView setAnimationsEnabled:NO];
draggedView.frame = [imageView.superview convertRect:imageView.frame toView:window];
[window addSubview:draggedView];
[UIView setAnimationsEnabled:areEnabled];
[UIView beginAnimations:@"" context:NULL];
CGPoint center = [aGestureRecognizer locationInView:window];
center.y -= 20.0;
draggedView.center = center;
draggedView.transform = CGAffineTransformIdentity;
[UIView commitAnimations];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment