开发者

Forcing Touches to Multiple Views

I have two overlapping custom views that need to both receive touch events (e.g. touchesBegan and touchesMoved). However I can only get one of 开发者_C百科the Views (the top one) to receive the events. I have tried forwarding the events from one view to the other view using:

[otherView touchesEnded:touches withEvent:event];

but this does not always work.

I need the touch events to be sent to the two views simultaneously. Can anyone help?


If you intercept a touch, you should usually call [super methodYouAreIntercepting] at the end of the method, if you still want the touch to go through to the next layer. If you do this, and the two views are directly on top of each other, then you don't need to manually forward the touches the way you have been doing. because your comment above suggests that you haven't been calling super in the method, I bet this will solve your issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜