Is there a 1-to-1 ratio of motionBegan and motionEnded events?
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.
精彩评论