views:

15

answers:

1

I have a UIScrollView and added a UIView inside it, when I zoom it, is it possible to get the CGRect of the zoomed frame in relation to the original frame?

E.g. i have 800x600 frame, then i zoomed to {{50, 60}, {100, 100}} is it possible to programmatically get the zoomed frame?

+1  A: 

I usually use the following method (added to the custom UIScrollView category):

- (CGRect) visibleRect{
    CGRect visibleRect;

    visibleRect.origin = self.contentOffset;
    visibleRect.size = self.bounds.size;

    visibleRect.origin.x /= self.zoomScale;
    visibleRect.origin.y /= self.zoomScale;
    visibleRect.size.width /= self.zoomScale;
    visibleRect.size.height /= self.zoomScale;
    return visibleRect;
}
Vladimir
thank you, worked as expected :)
Manny