Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在执行此答案中描述的摇动手势,但是如果我摇动手机超过一秒钟,则不会调用motionEnded。
操作系统是否保证了motionBegan 和motionEnded 事件的比例不是1:1,或者这是响应者链的问题并且事件被发送到其他地方?
要么 要么motionEnded:withEvent:应该motionCancelled:withEvent:被调用。从文档中motionCancelled:withEvent:
motionEnded:withEvent:
motionCancelled:withEvent:
当 Cocoa Touch 框架接收到需要取消运动事件的中断时调用此方法。这种中断可能会导致应用程序不再处于活动状态或视图从窗口中删除。如果晃动时间过长,也可以调用该方法。