I have a UIView C which is a subview of UIView B wich is a subview of UIView A. I add a UIPanGestureRecogizer to UIView C with a selector called "selectorX" and I want that when UIView C goes out of UIView A frame, then its superview changes to UIView A and I want also to change its UIPanGestureRecognizer with another selector "selectorY".
This is my code:
-(void)selectorX:(UIPanGestureRecognizer*)sender{
CGPoint translation = [sender translationInView:self.view];
sender.view.center = CGPointMake(sender.view.center.x, sender.view.center.y +translation.y);
[sender setTranslation:CGPointMake(0, 0) inView:sender.view];
UIView *uiViewC=(ImagenFichaView *)sender.view;
if (sender.view.center.y+translation.y<-50) {
[uiViewC removeFromSuperView]
CGPoint newCenter=[sender locationInView:uiViewA];
[uiViewA addSubview:uiViewC];
uiViewC.center=newCenter;
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(selectorY:)];
panRecognizer.delegate=self;
[uiViewC removeGestureRecognizer:sender];
[uiViewC addGestureRecognizer:panRecognizer];
}
}
Everything goes well but the transition between the 2 UIPanGestureRecognizers is not continuous. When uiViewC changes its superView, the drag action stops. I have to take off my finger from the screen and start the movement again. What can I do to make the movement continuos? Thank you very much