0
我试图做一个游戏,涉及点击和拖动瓷砖创建路径,类似于流行的游戏Flow Free.选择和拖动瓷砖
我希望能够选择瓷砖和滑动我的手指都在一个滑动,但我有一些问题。 我一直在使用SwipeGestures尝试,在
// listen for swipes to the left
UISwipeGestureRecognizer * swipeLeft= [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeLeft)];
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
[[[CCDirector sharedDirector] view] addGestureRecognizer:swipeLeft];
// listen for swipes to the right
UISwipeGestureRecognizer * swipeRight= [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeRight)];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[[[CCDirector sharedDirector] view] addGestureRecognizer:swipeRight];
// listen for swipes up
UISwipeGestureRecognizer * swipeUp= [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeUp)];
swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
[[[CCDirector sharedDirector] view] addGestureRecognizer:swipeUp];
// listen for swipes down
UISwipeGestureRecognizer * swipeDown= [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeDown)];
swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
[[[CCDirector sharedDirector] view] addGestureRecognizer:swipeDown];
我的问题是SwipeGestures只承认每个屏幕上,按下一个刷卡 - 如果我改变方向,中期刷卡,不登记。
假设我需要使用UIGestureRecognizers,是否可以使用PanGestureRecognizer和SwipeGestureRecognizer来持续检查滑动方向的变化? 任何帮助,将不胜感激。提前致谢!
这是因为您正在为每个滑动方向传递不同的方法,而不是让UIPanGestureRecognizer检测滑动方向。 –