Reputation: 5150
I have a UIImageView
inside a UIScrollView
, I also implemented this method:
- (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return self.imageView;
}
For the image to resize inside the UIScrollView
, but I want to allow the user to change the y axis of the image and move it up and down, not just to pinch and resize.
I set the UIImageView
contentMode
to UIViewContentModeScaleAspectFit
and gave the UIScrollView
a maximumZoomScale
of 0.5f
How could I do that?
Upvotes: 1
Views: 533
Reputation: 2835
Try putting a bigger contentSize
in the UIScrollView
than the Frame
. Then set the Frame
of the UIImageView
the same size as the UIScrollView contentSize
.
Example
- (void)viewDidLayoutSubviews
{
[self.imageView setFrame:CGSizeMake(320, self.view.frame.size.height* 1.5)];
[self.scrollView setContentSize:CGSizeMake(320, self.view.frame.size.height* 1.5)];
}
Upvotes: 1