Reputation: 279
I have an image inside a UIScrollView. What I want to happen is if I zoomed in to a particular position, I want to disable the scrolling (both vertical and horizontal) so that it will remain on the zoomed area. Can you give me any ideas on how to do this?
Upvotes: 0
Views: 108
Reputation: 25907
Two things to keep in mind:
UIScrollViewDelegate
to accomplish that).contentSize
of your UIScrollView
the same size of your frame. This way both the horizontal and the vertical scroll will be disable.CGRect myScrollViewRect = myScrollView.frame;
CGSize myScrollViewFrameSize = CGSizeMake(myScrollViewRect.frame.size.width, myScrollViewRect.frame.size.height);
myScrollView.contentSize = myScrollViewFrameSize;
For clarity I putted more code than you would normally need to.
Upvotes: 1