How to use Shake API in iPhone SDK 3.0?
The APIs you are looking for are in UIResponder: – (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event; – (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event; – (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event; Generally you just implement this: – (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (event.type == UIEventSubtypeMotionShake) { //Your code here } } in your UIViewController subclass (UIViewController is a subclass of UIResponder). Also, you want to … Read more