如何使用cocos2d为iphone做手势识别器? 只有左/右/上/下 任何人都可以给我一些例子或教程吗? 非常感谢。
答案 0 :(得分:0)
`UISwipeGestureRecognizer *swipeGestureRecognizerright = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipe:)];
swipeGestureRecognizerright.direction = UISwipeGestureRecognizerDirectionRight;
swipeGestureRecognizerright.numberOfTouchesRequired = 1;
swipeGestureRecognizerright.delegate = self;
[self.scrollView addGestureRecognizer:swipeGestureRecognizerright];
[swipeGestureRecognizerright release];
-(void)didswipe:(UISwipeGestureRecognizer *)gesture{
//do something
}
`