Cancel touch event while touching

I need to cancel the touch event during touchphonesMoved so that the underlying uiviews can receive events. See comments below:

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{

    for (UITouch *touch in touches)
    {

        if (touch.view == self.touchOverlay) {
            CGPoint touchLocation = [touch locationInView:touch.view];

            //perform checks on touch location and trip sensor if circumstances are met

            if (self.touchSensorTripped) {
                self.touchOverlay.userInteractionEnabled = NO;
                //NEED TO CANCEL THE TOUCH HERE SO THAT VIEWS UNDERNEATH CAN RECEIVE THE TOUCH EVENTS
            }

        }

    }
}

      

Currently, base views do not receive touch events until ENDS is touched, which is too late. I need them to immediately start receiving event messages when the overlay is disabled and touches are still moving. What can I paste if the comment above is to do this?

+3


source to share


1 answer


I just did a little bit of tinkering with the test app and found that the call [[self superview]touchesMoved:touches withEvent:event];

seemed to work for a simple view hierarchy, if that's what you have. The superviewMoved element was definitely called before the view touched Ended. Calling oversight touchsMoved prematurely thus did not cause it to be called again



0


source







All Articles