Reputation: 15296
I want to perform self.scrollview zoomToRect:animated
such that the rect
is relative to the UIImage
and not the UIImageView
embedded inside that scrollView
How can I do this?
Upvotes: 0
Views: 565
Reputation: 15296
So the problem was converting the coordinates from the UIImage
to the UIScrollView
This library helped a lot.
so added a method in my class
-(void)zoomToRectInImage:(CGRect)rect
{
CGRect r = [self.imageView convertRectFromImage:rect];
CGRect zoomrect = [self convertRect:r fromView:self.imageView];
[self zoomToRect:zoomrect animated:YES];
}
Upvotes: 1