1

My cocos2d app have shake feature, I develop shake feature using UIAccelerometer. In iOS 8 UIAccelerometer meter is not working. Can any one help me, How to detect shake Gesture in cocos2d app.

Thanks....

Sudhakar
  • 1,517
  • 1
  • 10
  • 22
  • `- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration` is this function not working .. even if you use .. `[[UIAccelerometer sharedAccelerometer] setDelegate:self];` .. or `self.isAccelerometerEnabled = YES;` in `init` or `onEnter` in `CCLayer`? – rahul_send89 Oct 08 '14 at 11:28
  • let me know if down answer is not what you are looking for. will be happy to change or delete. – – rahul_send89 Oct 09 '14 at 23:56

1 Answers1

0

Add this to your View Controller:

override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent?) {
    if motion == .MotionShake {
        // do something cool
    }
}
Justin Vallely
  • 5,932
  • 3
  • 30
  • 44