I have a UIScrollView which I'm using to represent an axis on a graph. I'd like the user to be able to zoom in on the axis using the usual pinch motion, but for it to only scale in the vertical direction, not horizontally.
My question is similar to this one, but I've tried the solution suggested there (overriding the subview's SetTransform method so that it ignores scaling in one direction) and it works perfectly when constraining scaling horizontally, but not vertically. When I try implementing it vertically the first pinch action works fine, but subsequent pinches seem to reset the zoom scale to one before having any effect.
Does anyone know what might be causing this behaviour, and more importantly how I can get around it?
I'm using MonoTouch but answers using Objective-C are fine.
UIScrollView
. I'd guess a scroll view is the right way to do this, the momentum physics and all that inUIScrollView
make it a mistake to roll things yourself, but but I don't know how to do it. Perhaps watch some WWDC session videos (for every year of the conference, since they don't repeat previously covered topics). – Abhi Beckert