I ended up having to handle also UIControlEventTouchDragInside
event. Though this looks a workaround, thinking on the fundamentals of these touch drag events makes it a reasonable solution. All drag events are sourced from touchesBegan, touchesMoved and touchesEnded
. Apple added some threshold before UIControlEventTouchDragOutside
is sent, but up until that threshold UIControlEventTouchDragInside
event is certainly sent.
My solution was to remove overridden continueTrackingWithTouch
method and go on with its default implementation. Then I handled both inside and outside events, and moved my initialization code from exit event to inside event, and added control statements in inside event. Abstracted code looks like below:
-(void) dragInside:(UIButton *) sender withEvents:(UIEvent *) event
{
if(stillInsideOriginalControl) return;
UITouch *touch = [[event allTouches] anyObject];
CGPoint relativeLocToInitialCell = [touch locationInView:sender];
[self processTouch];
}
-(void) dragOutside:(UIButton *) sender withEvents:(UIEvent *) event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint relativeLocToInitialCell = [touch locationInView:sender];
[self processTouch];
}