本文介绍了UIScrollView中的UISwipeGestureRecogniser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在UIScrollView中使用UISwipeGestureRecognizer?

is it possible to have a UISwipeGestureRecognizer work in a UIScrollView?

我有一些UIImageViews可以向上或向下滑动,但是由于内容大于窗口大小,所有这些都必须位于UIScrollView内.因此,当我尝试滑动UIImageView时,整个屏幕都会滚动.

I have some UIImageViews that I move with a swipe up or down, but this all needs to be inside a UIScrollView as the content is larger than the window size. So when I try to swipe the UIImageView the whole screen scrolls. 

推荐答案

这是对我有用的解决方案

This is the solution that worked for me

[[scrollView panGestureRecognizer] requireGestureRecognizerToFail:yourSwipeGestureRecognizer];

尽管它仅适用于ios 5.0及更高版本.

although it only works in ios 5.0 and above.

这篇关于UIScrollView中的UISwipeGestureRecogniser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 13:51