开发者

Is there a 1-to-1 ratio of motionBegan and motionEnded events?

开发者 https://www.devze.com 2022-12-11 08:42 出处:网络
I\'m implementing shake gestures as described in this answer however if I shake my phone for longer than a second, motionEnded doesn\'t get called.

I'm implementing shake gestures as described in this answer however if I shake my phone for longer than a second, motionEnded doesn't get called.

Is t开发者_StackOverflow中文版here not a 1-to-1 ratio of motionBegan and motionEnded events guaranteed by the OS, or is this a problem with the responder chain and events are getting sent elsewhere?


Either motionEnded:withEvent: or motionCancelled:withEvent: should be called. From the docs for motionCancelled:withEvent:

This method is invoked when the Cocoa Touch framework receives an interruption requiring cancellation of the motion event. This interruption is something that might cause the application to be no longer active or the view to be removed from the window. The method can also be invoked if the shaking goes on too long.

0

精彩评论

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

关注公众号