I've tried using shake Gesture Recognition wrapper to detect the shake gesture. I've also tried to implement the code suggested in the Geeky Lemon. But I am unable to handle the shake gesture. Is there any way to get the shake gesture recognized?
Thank you!
EDIT 1:
The code is done by the help of the shake Gesture Recognition wrapper demo.
in the init method
ShakeDispatcher * dispatcher = [ShakeDispatcher sharedInstance];
[dispatcher addShakeListener:self];
[[[CCDirector sharedDirector]view] addGestureRecognizer:dispatcher];
-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if ( event.subtype == UIEventSubtypeMotionShake ){
NSLog(@"Shake detected");
}
}
Create your gesture recogniser the normal way and then add it like so
[[[CCDirector sharedDirector] view] addGestureRecognizer:shakeGesture];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With