I'm using a UIPinchGestureRecognizer
to adjust the width (not the height) of a view in a UIScrollView
. It works with the pinch gesture's scale
property, but the contentOffset
of the scrollview doesn't change, so the view always increases on the right. This looks a bit better if I scale the contentOffset
along with the width, since then the view increases from the left-most side of the screen.
The problem is that the location of the pinch is ignored - so it always appears that a pinch is on the left side of the screen.
I need to somehow factor in the location of the pinch to the contentOffset
adjustment, so that the offset can be adjusted to keep the content at the pinch point to be in the same place.
Note: I cannot use built-in UIScrollView
pinch-zoom gesture as I only want the zoom to be one dimension, horizontal. Also, I cannot use transforms on the UIView
as I need to use the UIScrollView
.