Imam Arief W
Imam Arief W

Reputation: 557

getting image size when image zoomed by user

how can i get the image size when it's zoomed by user, i write these on my project :

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
 return imageView;
}
-(void) didLoad{
 UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage      imageNamed:@"image.jpg"]];
 self.imageView = tempImageView;
 [tempImageView release];

 scrollMapView.contentSize = CGSizeMake(imageView.frame.size.width, imageView.frame.size.height);
 scrollMapView.maximumZoomScale = 4.0;
 scrollMapView.minimumZoomScale = 0.75;
 scrollMapView.clipsToBounds = YES;
 scrollMapView.delegate = self;
 [scrollMapView addSubview:imageView];
}

i just want to know the image size when it zoomed.. thank you.

Upvotes: 0

Views: 220

Answers (2)

yosh
yosh

Reputation: 3305

Maybe you can do just:

newZoomedWidth = scrollView.zoomScale * imageView.frame.size.width

Upvotes: 3

Peter Hosey
Peter Hosey

Reputation: 96333

I could be wrong about this (I'm not an iPhone developer), but I don't think the image itself gets zoomed; it's only the scroll view's display of the image view that gets zoomed. So, it's only a property of the scroll view that changes; the image remains unchanged.

That means you should be able to just get the image view's image and ask that for its size.

If you want the image's zoomed size rather than its original size, get its original size and multiply both dimensions by the scroll view's zoom scale.

Upvotes: 1

Related Questions