开发者

Stop touch event during touch move

In my game, when time is up, I want to display another view and stop the interaction on the others currently used before the time stopped. But when the other view is coming, if I let my finger o开发者_C百科n the screen, I can stil drag into the view behind the new view and continue the game.... That's not the purpose.

I want to lose the focus of the finger, or cancel the finger... I tried to set userInteraction to NO.. but not working.

Can somebody knows how to solve this issue?

The quickFix is to setup a shared variable and test it in the touchBegan and TouchMoved event.. but that's not proper :)

Thank a lot!


Your -touchesMoved:withEvent: method can check whether the timer is still running before it does anything. If the timer expires, it stops changing anything.


1.Ignore the events while animation.

2.Instead of setting userInteraction to NO ignore the events.

Use these methods to ignore events

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜