【发布时间】:2012-08-23 13:02:52
【问题描述】:
我尝试使用shake Gesture Recognition wrapper 来检测摇晃手势。 我还尝试实现Geeky Lemon 中建议的代码。 但我无法处理摇晃手势。有什么方法可以识别摇晃手势吗?
谢谢!
编辑 1:
代码是在摇动手势识别包装演示的帮助下完成的。
在初始化方法中
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");
}
}
【问题讨论】:
标签: iphone cocos2d-iphone gesture shake