1
votes

I have a large image (1024x1024) inside a UIScrollview, and the scrollview is inside a UIView. I put the image into the scrollview, and set the scrollview size equal to 1024, along with the UIImageview size to 1024. The UIView size is 320x320.

It only lets me scroll a little bit around the image, basically just letting me see the top left of the image. What am I doing wrong?

2
did you set the content size of the scrollView to the full size of the uiimageView?Nilzone-
I set it equal in the Size Inspector, if that's what your asking. Unless content size is something different. I have autolayout off, by the way.fefewaf feaf

2 Answers

3
votes

You need to set the contentSize of your UIScrollView.

The scrollView frame represents the position and size of the scrollView on the screen, instead the contentSize is the size of the content inside the scrollView (that potentially could be much bigger of the frame of the scrollView). So, something like this will do (assuming you have a UIScrollView and an UIImageView that already contains the UIImage that you want to display.

_scrollView.contentSize = _imageView.image.size;
0
votes

Your container view is having size (320X320). But, the scrollview inside that view having size of (1024X1024) which is exactly same as your image. So, how can it scroll ? You need to set scrollview size equal to (320X320) and then set its content size. Calculate height and width of that image and set content size as per that.