0

I have a UIImageView object and UIPanGestureRecognizer that I want to attach to it. UIPanGestureRecognizer gets move method as a selector. What I want to do is :When I drag the ImageView, I want to make a clone of it and also add a gesture recognizer to it as well. The problem is the move method has only one parameter which is like move (UIPanGestureRecognizer *)sender

but the problem is the move method only knows about the first imageview object. I tried to create a method like move:(UIPanGestureRecognizer*)sender :(UIImageView *)img to send a different imageview as a second paramater but it throws an error (unrecognized selector ....) in the following code. How can I add a method which has multiple paramaters to the selector?

UIPanGestureRecognizer *panRecognizer = [[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:imageView:)] autorelease];
Ron
  • 24,175
  • 8
  • 56
  • 97
  • [Take a look at this answer, it might help you with the question regarding passing a parameter.][1] [1]: http://stackoverflow.com/questions/8229370/ios-add-a-parameter-to-selector – Kevin Horgan Jun 03 '12 at 13:32

1 Answers1

2

You could simply get the image view from the gesture recognizer, using its view property.

omz
  • 53,243
  • 5
  • 129
  • 141