我已经堆叠在彼此顶部上的相同大小的3个UIViews。 最上面的是透明的,仅用于检测触摸。 检测到触摸的类型将决定我想收到的触摸事件,其中另外两个基本观点。 一旦最顶部视图与触摸完成,我需要触摸事件转发到正确的基础视图。 我怎样才能做到这一点?
编辑 - 我加入我的触摸检测代码。 这是内MainViewController,其视图包含所有子视图3。
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches)
{
if (touch.view == self.touchOverlay) {
CGPoint touchLocation = [touch locationInView:touch.view];
//do a bunch of math to determine which view should get the touches.
if (viewAshouldGetTouches) //forward to viewA
if (viewBshouldGetTouches) //forward to viewB
}
}
}