views:

227

answers:

2

I want to zoom an image in a scroll view. I used the below code. All are working fine, but the image is not zooming. Anyone please help. I am a beginner in iPhone app development.

I had connected the delegate to files manager and set max zooming to 5

I can see the image. But how can I zoom it.

IBOutlet UIScrollView *scrForImg; IBOutlet UIImageView *imgForScr;

  • (void)viewDidLoad { [super viewDidLoad];

    NSString *imagePath = [NSString stringWithFormat:@"myImage.png"];

    imgForScr.image = [UIImage imageNamed:imagePath];

}

-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{

return imgForScr;

}

+1  A: 

This is all documented here.

HTH.

Alfons
Unfortunately, none of Apple's samples demonstrate zooming the way Photos does it, which is definitive. I've filed a radar for this:http://openradar.appspot.com/radar?id=204402Please duplicate if you want the extra functionality of Photos explained.
Steven Fisher
A: 

The image needs to exist in an UIImageView, then you should be able to pan/zoom.

Is it visible? Or does the scroll view contain nothing at all?

JoePasq