Scrollview - two finger scrolling

I’m trying to make a scrollview that will scroll using two fingers and I can get this to work by adding the following to the scrollview controller:

self.scrollView.panGestureRecognizer.minimumNumberOfTouches = 2;
self.scrollView.panGestureRecognizer.maximumNumberOfTouches = 2;

Problem is that I want to use single finger touches and when I try and add overrides for touches began, etc, my two finger scrolling becomes unravelled and scrolling becomes active again using one touch.

Anyone have any ideas or can point me in the right direction?

I have added an image so you can get an idea of the use-case (it’s not actually this but it will illustrate what is required).

I want to scroll and magnify the map with two fingers, I want to move the blue circle (a UIView) with a single finger and be able to do a single finger tap.

Any pointers appreciated.

Hi @andrews, have you taken a look a this UIGestureRecognizer tutorial? It goes over using a gesture recognizer to move an image. I hope this points you in the right direction!

Best,
Gina

Thanks Gina, the gesture itself isn’t so much an issue. The problem is that I can’t use single finger touches AND the two finger scroll. The two finger scroll works fine.

I did discover since posting that the simulator doesn’t work reliably in this scenario and I absolutely have to test on hardware.

Thanks for the heads-up.

Paul

This topic was automatically closed after 166 days. New replies are no longer allowed.