I want to programatically zoom in on an Image. I have created a simple UIVIew containing two subviews. A UIImageView and UIView ‘holder’ containing subviews that are basically graphical frames. The end result is a ‘flickr style’ image view. An image with visible box frames ‘on top’ of the image. For simplicity I have used a UIImage that is twice the screen (960 / 640) and I do not scale at all. So all of the views are sized to fit the original dimensions of the UIImage.
I placed this custom UIView in a UIScrollView and set the content size to the UIImage dimensions (960/640).
// display the image --- This works great
[scrollView zoomToRect:CGRectMake(0, 0,960, 640) animated:YES];
// points are relative to the original UIImage....
// zoom to rect -- also works great!
[scrollView zoomToRect:CGRectMake(252,126,184,97) animated:YES];
But if the rect falls outside of 480/320 or thereabouts things start to wrong.
// zoom to rect -- not so great.....
[scrollView zoomToRect:CGRectMake(520,126,100,97) animated:YES];
Any suggestions? What have I missed? contentoffset?
End goal is just to programatically (no touches) zoom in these boxes. With or without UIScrollView... thanks!