如何将一个触摸事件从一个UIView传递到它下面的UIView?
一个简单的问题,但我找不到解决scheme:
我有两个UIViews,一个在同一个父视图之上。 两者都有GestureRecognizers
,但只有最顶级的是接收事件。 我怎样才能让最顶层的视图通过所有的手势,他得到其他UIViews下面呢?
这是我通过触摸…
子类uiview并添加
-(id)hitTest:(CGPoint)point withEvent:(UIEvent *)event { UIView *hitView = [super hitTest:point withEvent:event]; if (hitView == self){ return nil; } else { return hitView; } }
看来你需要为上述任务使用NSNotificationCenter。 看看这个教程 。