event touchesForView:在超级视图中返回null

时间:2012-02-19 18:05:34

标签: objective-c cocoa-touch uiview multi-touch responder-chain

我有一个名为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不会覆盖任何事件处理方法(touchesBegantouchesMoved等)。我希望视图的触摸计数包含其子视图中的所有触摸,但它似乎没有那样工作。我在代码中做错了什么,或者这是应该工作的方式,我不明白为什么? (如果是后者,为什么这样更好?)

谢谢!

0 个答案:

没有答案