How to detect shake Gesture in your iPhone Cocos2D? in iOS 8

288 views Asked by At

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....

1

There are 1 answers

0
Justin Vallely On

Add this to your View Controller:

override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent?) {
    if motion == .MotionShake {
        // do something cool
    }
}