Is there any way to change the first responder halfway through a touch event?
I have a popover that should dismiss and resignFirstResponder if it recognizes a UIPanGesture. However, it still keeps the firstResponder until about a second later after it has started dismissing.
My goal is to "drag" a UIImageView out of the popover into the mainViewController. When the user drags a UIImageView in the popover, the popover should dismiss and a new UIImageView should be created in the mainControllerView that can be dragged around.
mainControllerView.m
-(IBAction)panGesture:(UIPanGestureRecognizer*)sender
{
if (showPiecesPopover.isPopoverVisible) {
[self.view removeGestureRecognizer:panGestureRecognizer];
panGestureRecognizer = [((PopoverCreateNewBoardViewController*)showPiecesPopover.contentViewController) panGestureRecognizer];
panGestureRecognizer.delegate = self;
[self.view addGestureRecognizer:panGestureRecognizer];
[showPiecesPopover dismissPopoverAnimated:YES];
}
if (movingPiece) {
[selectedPieceImageView setCenter:[sender locationInView:self.view]];
}
}
popover.m
-(void)viewWillAppear:(BOOL)animated
{
panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:creatorViewController action:@selector(panGesture:)];
[self.view addGestureRecognizer:panGestureRecognizer];
}
With this code the UIPanGestureRecognizer is called, but only for about a second due to the popover being dismissed as firstResponder. How do I change the firstResponder to the mainViewController's view?
On an unrelated note, the UIPanGestureRecognizer does not recognize a pan if the user does not move his fingers for a second then moves the fingers. Turning the recognizing simultaneous gestures on did not change anything