在我的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];
}
答案 0 :(得分:1)
{
UISwipeGestureRecognizer *swipeGestureup = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(oneFingerSwipeUp:)];
[swipeGestureup setDirection: UISwipeGestureRecognizerDirectionUp ];
[[[CCDirector sharedDirector] openGLView] addGestureRecognizer:swipeGestureup];
[swipeGestureup release];
}
- (void)oneFingerSwipeUp:(UISwipeGestureRecognizer *)recognizer{
NSLog(@"swipe auction called");
}