I know how to add a gesture recognizer through IB, but I'm trying to figure it out with IB.
So basically what is now
blue1.userInteractionEnabled = YES; UIPanGestureRecognizer *pgr = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; [blue1 addGestureRecognizer:pgr]; [pgr release];
and my handlePan
-(IBAction)handlePan:(UIPanGestureRecognizer *)recognizer { CGPoint translation = [recognizer translationInView:self.view]; recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x, recognizer.view.center.y + translation.y); [recognizer setTranslation:CGPointMake(0, 0) inView:self.view]; }
this works great if I do it on IB and I can shoot the fragment around.
I do not understand what makes it not move, as if it is now encoded.
Any help is appreciated.
I also tried - (void) instead of - (IBAction) in my handlePan, but that didn't work either.
user1213042
source share