views:

38

answers:

1

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.

A: 

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.

Peter Hosey