Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIScrollView and content with requires touch move events

I have a view which is using single touch events (single finger) for drawing (lines, cycles, text, and so on). Now I want to put this view inside of UIScrollView, which will allow zooming and panning. Of course two fingers are required to perform both zooming and panning.

What is the pattern do do that? I've found only examples when contents of UIScrollView accepts only single clicks (it contains only a buttons). Nothing what to do when contents require also touch moves.

like image 998
Marek R Avatar asked Feb 17 '23 08:02

Marek R


1 Answers

Access the panGestureRecognizer property on the UIScrollView, and set its minimumNumberOfTouches property to two:

myScrollView.panGestureRecognizer.minimumNumberOfTouchesRequired = 2;
like image 75
Steven McGrath Avatar answered Feb 18 '23 20:02

Steven McGrath