监听摇一摇

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   /** 摇动结束 */

posted @ 2015-08-24 16:54  Rinpe  阅读(177)  评论(0编辑  收藏  举报