1

我有一个名为 BigView 的 UIView 子类,它覆盖 touchesMoved (除其他外),如下所示:

@implementation BigView
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    NSSet * viewTouches = [event touchesForView:self];
    NSLog(@"set of touches: %@", viewTouches);
}
@end

我的 BigView 实例也有一个子视图(常规 UIView 实例) - 当我在该子视图内触摸时,上述touchesMoved方法被调用,但viewTouches为空。subView 不会覆盖任何事件处理方法(touchesBegan,touchesMoved等)。我希望视图的触摸计数包括其子视图中的所有触摸,但它似乎并没有那样工作。我在代码中做错了什么,或者这是它应该工作的方式,我不明白为什么?(如果是后者,为什么这样更好?)

谢谢!

4

0 回答 0