Question

I have a scroll view with an image view. And I want to zoom the image in all direction equally. But when I am trying to do it's not happening.

But its zooming image only in vertical direction not in horizontal direction. I have done this:

[monthView setImage:[monthArray objectForKey:dateString] ];
 scrollView1.contentSize=CGSizeMake(1280, 960);
#pragma scrollview delegates
-(UIView *) viewForZoomingInScrollView:(UIScrollView *)scrollView
 {

return monthView;
}

No correct solution

OTHER TIPS

Write minimumZoomScale and maximumZoomScale value of scrollView in viewDidLoad

 _scrollview.minimumZoomScale=1.0;
 _scrollview.maximumZoomScale=2.0;

Set zooming scale for scrollview. Like:

self.myScrollView.minimumZoomScale = 1.0;
self.myScrollView.maximumZoomScale = 5.0f;

And Make sure monthView is a subview of scroll view.

Hope this helps. :)

1 Set your view controller up as a .

2 Draw your UIScrollView the size you want for the rectangle at the center of the view. Set the max zoom in the inspector to something bigger than 1. Like 4 or 10.

3 Right click on the scroll view and connect the delegate to your view controller.

4 Draw your UIImageView in the UIScrollView and set it up with whatever image you want. Make it the same size as the UIScrollView.

5 Ctrl + drag form you UIImageView to the .h of your View controller to create an IBOutlet for the UIImageView, call it something clever like imageView.

6 add this code.

-(UIView *) viewForZoomingInScrollView:(UIScrollView *)scrollView {return self.imageView;}

7 Run project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top