I have UIScrollView. I should show small image first, and big image , when I zoom image. If I use this code, everything is OK:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollViewCalled
{
ImageScrollView *scroll = scrollViewCalled
UIImageView *imageView = (UIImageView *)[scroll viewWithTag:kImageViewTag];
return imageView;
}
The size of ImageView = the size of image (if image is small, it meens, that = the size of small image, if image is big - the size of big image) ContentSize of scrollView = size of imageView.
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollViewCalled withView:(UIView *)view atScale:(float)scale
{
ImageScrollView *scroll = scrollViewCalled
UIImageView *imageView = (UIImageView *)[scroll viewWithTag:kImageViewTag];
if ([self isBigImage:imageView])
{
return;
}
[self loadBigImage];
}
But if use this code (when I try to zoom, the big image is shown, but I see its maximum zoom scale, and I can't scroll to see the rest part of the image. But when I zoom one more time instead of scrolling the image, it begins to work properly and I finally can scroll the image. But I should zoom 2 times for that):
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollViewCalled withView:(UIView *)view
{
ImageScrollView *scroll = scrollViewCalled
UIImageView *imageView = (UIImageView *)[scroll viewWithTag:kImageViewTag];
if ([self isBigImage:imageView])
{
return;
}
[self loadBigImage];
}
Why doesn't it work properly for scrollViewWillBeginZooming? I need to set big image before zooming, but not after.