3
我需要在touchesMoved期间取消触摸事件,以便潜在的uiviews可以接收事件。请参阅下面的评论:touchesMoved期间取消触摸事件
-(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
}
}
}
}
目前,底层视图直到触摸ENDS时才会收到触摸事件,这太迟了。我需要他们在叠加视图禁用时立即开始接收touchesMoved事件,而触摸仍在移动。我可以在评论的上面插入什么来执行此操作?
感谢您的回应。事实上,我可以通过调用self.superview touchesMoved来获取touchesMoved以在父视图控制器中调用。但是,基础视图包含滚动视图,并且在手动调用touchesMoved时,这些滚动视图不会响应。我需要这些滚动视图才能正常工作。你能想到其他方式吗?我只希望上面的观点能够通过它下面的观点。 – soleil