10. Two fingers gesture on UIScrollView

Most of the times we want to do something different in iOS apps, one of them is two go for 2 finger scroll instead of 1, so that we can have some other control like UITextView in 1 finger scroll. So here is the code to have this:

for (UIGestureRecognizer *gestureObj in self.detailContainerScrollView.gestureRecognizers) {
if ([gestureObj isKindOfClass:[UIPanGestureRecognizer class]])
{
UIPanGestureRecognizer *panObj = (UIPanGestureRecognizer *) gestureObj;
panObj.minimumNumberOfTouches = 2;
panObj.maximumNumberOfTouches = 2;
}
}

Leave a Reply