监听摇一摇

iOS自带的Shake监控API(非常简单)

判断摇一摇的步骤:实现3个摇一摇监听方法(在AppDelegate中实现)

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event   /** 检测到摇动 */

- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event   /** 摇动取消(被中断) */

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event   /** 摇动结束 */

原文地址:https://www.cnblogs.com/Rinpe/p/4755240.html