[英]How to detect shake Gesture in your iPhone Cocos2D? in iOS 8
My cocos2d app have shake feature, I develop shake feature using UIAccelerometer. 我的cocos2d应用程序具有震动功能,我使用UIAccelerometer开发了震动功能。 In iOS 8 UIAccelerometer meter is not working.
在iOS 8中,UIAccelerometer仪表无法正常工作。 Can any one help me, How to detect shake Gesture in cocos2d app.
谁能帮我,如何在cocos2d应用中检测抖动手势。
Thanks.... 谢谢....
Add this to your View Controller: 将此添加到您的视图控制器:
override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent?) {
if motion == .MotionShake {
// do something cool
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.