0
votes

I have a UIScrollView with a UIImageView as a subview. I have defined this ImageView as the View for zooming. The ImageView's frame size is the same as the frame of the ScrollView.

When I first load the View Controller, I choose an image from the Asset library and load it into the ImageView. I then adjust this image by zooming and panning in the scroll view. I save the ZoomScale and ContentOffset data.

When I try to access the View Controller again, I set the ZoomScale and ContentOffset values to those that I saved when adjusting the image. But the image does not appear the same as when I first adjusted it. On subsequent loads, the frame of the ImageView becomea much larger than the frame of the scrollView. This does not happen on simulator but does happen on device.

Any help would be appreciated!

1

1 Answers

2
votes

This question seems potentially related: iphone uiscrollview and uiimageview - setting initial zoom

Are you setting the zoomscale before or after adding the image subview to the UIScrollView? Do it after.

If it's too large for the scrollview, have you set maximumZoomScale?

Finally, did you implement the following delegateMethod? Otherwise the scrollView doesn't necessarily know the image is supposed to be zoomable.

-(UIView *) viewForZoomingInScrollView:(UIScrollView *)inScroll;