Reputation: 6164
In iPhone App How to implement shake gesture?
Please Help and suggest.
Thanks
Upvotes: 2
Views: 3474
Reputation: 21571
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");
}
}
Upvotes: 2
Reputation: 8052
Look at the docs to UIResponder and the UIEventSubtypeMotionShake event (from this answer to another SO question).
Upvotes: 0