I have a UIScrollView
in which I've set the contentSize
to the size of the screen initially. So does this mean that if I have an UIImageView
inside the scroll view then it can't zoom bigger than the contentSize
I've set?
Because I initially have a UIScrollView
with a contentSize
of the phone's dimension and when I zoom into an image, it does it just fine (I can see the contentSize
grows bigger as I zoom in) but when I adjust it manually it can't. Why is this?
I think when I initially initialize the UIScrollView
frame, the content size will be set to the frame's size, however it can grow dynamically as I zoom in. However when I try to set the contentSize
, it seems that now it's fixed. The reason why I am asking this is because I have a UIImageView
inside a UIScrollView
, when I zoom in on the image and I rotate the image, I want the contentSize
to reset. Question is how do I reset this?
The zoom level is set by the
zoomScale
property of theUIScrollView
. Its maximum and minimum is set bymaximumZoomScale
andminimumZoomScale
respectively.If you're trying to set the zoom by setting the
contentSize
then you're doing it wrong. ThecontentSize
should be set as if the zoom scale was1.0
and then you'd just set thezoomScale
property to be what you wanted so for example2.0
if you wanted it zoomed in to 200%.You're probably seeing
contentSize
change as you zoom because I think the scroll view reports it scaled to the current zoom scale.