0
votes

I have got a UIScrollView with a UIImageView as subview. The contentSize of the ScrollView has been set to the size of the UIImageView. I implemented zooming and scrolling of the UIImageView.

I need the UIScrollView to keep the scroll rect when I change its frame (proportionally).

How is this done?

My problem is, whenever I change the frame of the UIScrollView the visible rect of the UIImageView changes.

Thanks!

1

1 Answers

0
votes

If I understand your problem correctly, you want to shrink the frame of the scroll view without changing what you are able to see inside of the scroll view. You can do this in the following way:

Create a new UIView and set its frame to the position and size that you want to see the content of the scroll view. Turn on the clips to bounds on that view, view.clipsToBounds = yes. Add the scroll view as a subview to the view you created. [view addSubview:scrollview]. Turn clips to bounds off on the scrollview, scrollview.clipsToBounds = no.

Hope that helps.