gpt4 book ai didi

ios - 平移手势和滑动手势

转载 作者:行者123 更新时间:2023-11-28 22:14:10 24 4
gpt4 key购买 nike

在我的项目中,我需要一个用于左右移动的滑动手势 Action ,我需要一个用于上下方向的平移手势 Action 。当我同时使用这两个手势时,只有平移手势在调用。有人对此有解决方案吗?

 UISwipeGestureRecognizer *rightSwipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(goToPreviosSong)];
rightSwipe.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:rightSwipe];

UISwipeGestureRecognizer *leftSwipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(goToNextSong)];
rightSwipe.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:leftSwipe];

对于 pan 我正在使用这个代码

UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)];
[self.view addGestureRecognizer:edgePanGesture];

最佳答案

[panGesture requireGestureRecognizerToFail:rightSwipe];
[panGesture requireGestureRecognizerToFail:leftSwipe];

关于ios - 平移手势和滑动手势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22163527/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com