I have a subclass of UIView ( CustomViewfor the purposes of this question), which has its own handling of all events touches(Start, Move, End, Canceled). I also have UIButtonwhich is a child CustomViewthat overlaps it.
For example, my view hierarchy is as follows:
- UIView (view of the controller)
- CustomView with frame (0, 0, 300, 300)
- UIButton with frame (0, 0, 100, 50)
I would like CustomView to capture touch events as soon as the user pulled out of UIButton. Through debugging logging, it seems that the event UIControlEventTouchDragExitis the one that intercepts (although it does not fire until the touch is at a distance of about 100 pixels from the button, but this is not important for this question).
Ideally, when a drag-and-drop event is triggered, the button stops receiving touch move events, CustomView receives the event touchesBegan(even if I need to fake it somehow) and all future touch events ( touchesMovedetc.) will be sent to CustomView.
I tried the following and it has no effect:
-(void)btnTouchDragExit:(id)sender
{
UIButton * btn = sender;
[btn resignFirstResponder];
[customView becomeFirstResponder];
}
, UITouch ( ) , CustomView. ?