Reputation: 1466
When using UIScrollView
for zooming, it seems that aspect ratio of a visible content is constant.
I would like to manage horizontal and vertical zoom independently. For example, if fingers touch screen horizontally then only horizontal scroll is changed. I noticed that type of UIScrollView.zoomScale
is float
(for all dimensions altogether). Is it possible to workaround this problem?
Details: I am working on an OpenGL ES based app and I'd like to use UIKit's scroll for a nice look and to save time implementing one.
Upvotes: 1
Views: 494
Reputation: 9902
I guess in your case you're better off not using a UIScrollView
, and instead setting up a UIPinchGestureRecognizer
yourself on the views you want to transform.
The GestureRecognizer would track the fingers and decide whether (and how much) to scale in which dimension. Based on this, you can set your view's transform
property. As an example, a transformation matrix that doubles the width but leaves height intact would be CGAffineTransformMakeScale(2.0, 1.0)
.
To leverage UIScrollView's scrolling, you then embed your view into a UIScrollView, and set the contentSize
and contentOffset
properties accordingly from your GestureRecognizer's callback methods.
Upvotes: 2