views:

239

answers:

1

Hi,

I was just wondering how I can get a single tap to undo the zoom inside of a scroll view? I cant seem to figure it out.

I was also wondering how do you know what size to set your scroll view contentSize, as I find this issue a little confusing at the moment I have it set at 460x320.

Thanks

A: 

You probably want to subclass UIScrollView and intercept the tap, then just set the zoomScale property to 1.0. You can also intercept the tap from a containing view. Hard to tell which is simpler, depends on your needs and view hierarchy. In general, I find it a bit hard to work with scroll views. Takes some experimentation to get things working the way you want to sometimes. Check out Apple's ScrollView suite example code. It does pretty much exactly what you are asking for.

Felixyz