【发布时间】:2011-06-07 16:46:16
【问题描述】:
我有两个重叠的自定义视图,它们都需要接收触摸事件(例如 touchesBegan 和 touchesMoved)。但是,我只能获取其中一个视图(顶部视图)来接收事件。我尝试使用以下方法将事件从一个视图转发到另一个视图:
[otherView touchesEnded:touches withEvent:event];
但这并不总是有效。
我需要将触摸事件同时发送到两个视图。有人可以帮忙吗?
【问题讨论】:
-
你是不是也转发了touchesBegan,以及你一直在拦截的其他touch相关的方法?你一直在喊超级吗?
-
叫super是什么意思?
-
Intead of [otherView touchesEnded:touches withEvent:event];使用 [super touchesEnded:touches withEvent:event];
标签: iphone uiview touch gestures touchesbegan