有没有办法在触摸事件中途改变第一响应者?
我有一个popover,如果它识别出UIPanGesture,它应该解除并且resignFirstResponder。然而,它仍然保持第一个响应者,直到它开始解雇后大约一秒钟。
我的目标是将UIImageView从popover“拖”到mainViewController中。当用户在弹出框中拖动UIImageView时,弹出框应该被忽略,并且应该在mainControllerView中创建一个可以拖动的新UIImageView。
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];
}
使用此代码调用UIPanGestureRecognizer,但由于popover被解除为firstResponder,因此只有大约一秒钟。如何将firstResponder更改为mainViewController的视图?
在一个不相关的注释中,如果用户没有移动他的手指一秒钟然后移动手指,则UIPanGestureRecognizer不会识别平移。转动识别同时手势并未改变任何内容