0

我正在使用 UIWindow 子类化 MainWindow 并使用命中测试方法:

-(UIView *)hitTestCGPoint)point withEventUIEvent *)event {

    UIView *hitView = [super hitTestoint withEvent:event];
    if (hitView == self)
        return [[self subviews] lastObject];
    else if([hitView isDescendantOfView:myView])
    {
        NSSet *touches = [event allTouches];

for (UITouch *touch in touches) {

if ([touches count] >= 2) { // 阻止这个 NSLog(@"Count =2"); return [[self subviews] lastObject]; } } } 返回命中视图;}

但我接触到零对象。我调试和检查的事件总是有 0 个对象。但响应者有事件的详细信息。为什么会这样,我应该如何获得水龙头计数?

4

1 回答 1

0

我认为您应该改写 -sendEvent: 。文档说明了以下关于 -sendEvent::

将 UIApplication 对象发送给接收者的事件分派给它的视图。

于 2010-01-10T14:39:01.457 回答