我有一个 UIScrollView,我在其中添加了一个 subview 。滚动 View 垂直滚动得很好,这就是它应该做的。我现在想在 UISwipeGestureRecognizer 的帮助下识别 subview 中的左/右滑动。我知道这是可能的,但我还没有找到解决方案,并且多次尝试都没有成功。
最佳答案
试试这些:
UIGestureRecognizer
和 shouldRecognizeSimultaneouslyWithGestureRecognizer
:-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
return YES;
}
shouldReceiveTouch
:- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
return YES;
}
希望这可以帮助
关于objective-c - UIScrollView subview 中的水平 UISwipeGestureRecognizer ? (UIScrollView 只需要识别垂直滚动),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14054403/