在我的 Box2d 游戏中,我尝试使用 uiswipegesture 来获得滑动手势,当我在测试项目中这样做时它工作正常,但是当我在 box2d 游戏中实现时,它不调用滑动动作这里是代码
{UISwipeGestureRecognizer *swipeGestureup = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(oneFingerSwipeUp)];
[swipeGestureup setDirection: UISwipeGestureRecognizerDirectionUp ];
[[[CCDirector sharedDirector] openGLView] addGestureRecognizer:swipeGestureup];
[swipeGestureup release];}
方法是
-(void)oneFingerSwipeUp:(id)sender{
NSLog(@"swipe auction called");
[player jump];
}