iOS - touchesMoved在子类UIScrollView中只调用一次

use*_*778 0 subclass objective-c uiscrollview touchesmoved ios

我试图在子类UIScrollView中删除可移动的UIImageViews,以便我可以在UIScrollView中拖动它们.我将UISCrollView子类化并且删除行为正常,但是当我尝试拖动图像时,touchesMoved仅被评估一次.我的UIScrollView子类中的touchesMoved方法如下所示:

-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    if (!self.dragging) {
        [self.nextResponder touchesMoved: touches withEvent:event]; 
    }else{
        [super touchesEnded:touches withEvent:event];
    }        
}
Run Code Online (Sandbox Code Playgroud)

它应该在移动触摸过程中被连续调用.任何人都可以想到我的视图控制器中的touchesMoved方法只会被调用一次的原因吗?

小智 5

IOS 5:UIScrollView没有将触摸传递给nextResponder

代替:

[self.nextResponder touchesMoved:touches withEvent:event]; 使用:

[[self.nextResponder nextResponder] touchesMoved:touches withEvent:event];