0
目前与panGesture刷卡并不完美。如果用户想要向上滑动,但是他向右移动一个像素,但其余的都已移动(用户向上滑动但在开始时略微向右移动),但是右侧将被激活,而右侧则不会。我认为集成swipeGesture会尽量减少这种错误,但它似乎不起作用。我想要它,所以当用户在开始时没有完全向上滑动时,向上仍然会被激活,而不是向左或向右。它可以向左或向右运动,但它不是100%完美的,因为用户只需要改变几乎不可能的y或x轴。uipangesturerecognizer与uiswipegesturerecognizer
-(void)pan:(UIPanGestureRecognizer *)sender
{
CGPoint distance = [sender translationInView:self.view];
UISwipeGestureRecognizer *swiping;
[myImage addGestureRecognizer: swiping];
//Not Working
if(swiping.direction == UISwipeGestureRecognizerLeft || swiping.direction == UISwipeGestureRecognizerRight) {
NSLog(@"Verticle")
} else if(swiping.direction == UISwipeGestureRecognizerUp || swiping.direction == UISwipeGestureRecognizerDown) {
NSLog(@"Horizontal");
} else if(distance.x > 0 || distance.x < 0) { // From here down working but not perfect
NSLog(@"Verticle")
} else if (distance.y < 0 || distance.y > 0) {
NSLog(@"Horizontal")
}
[sender setTranslation:CGPointZero inView:self.view];
}