我正在使用 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 个对象。但响应者有事件的详细信息。为什么会这样,我应该如何获得水龙头计数?