How to use UIPanGestureRecognizer to move object? iPhone/iPad
I found the tutorial Working with UIGestureRecognizers, and I think that is what I am looking for. It helped me come up with the following solution: -(IBAction) someMethod { UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)]; [panRecognizer setMinimumNumberOfTouches:1]; [panRecognizer setMaximumNumberOfTouches:1]; [ViewMain addGestureRecognizer:panRecognizer]; [panRecognizer release]; } -(void)move:(UIPanGestureRecognizer*)sender { [self.view bringSubviewToFront:sender.view]; CGPoint translatedPoint = [sender translationInView:sender.view.superview]; if … Read more