1

在我的 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];

}

4

1 回答 1

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");

  }
于 2012-07-26T05:47:14.437 回答