In iPhone App How to implement shake gesture?
Please Help and suggest.
Thanks
If your ViewController enable first responder
[self becomeFirstResponder]
and implement motionEnded:withEvent:
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (event.type == UIEventSubtypeMotionShake) {
NSLog(@"Shake is detected");
}
}
Find it here How do I detect when someone shakes an iPhone?
Look at the docs to UIResponder and the UIEventSubtypeMotionShake event (from this answer to another SO question).