views:

70

answers:

2

I have a subview inside a uiscrollview. Then I zoom it out. So it becomes bigger and allows me to scroll through it.

So what is actually changing here? ContentSize of UIScrollView?

A: 

The content size of the scrollview remains logically the same. If you check the frame of the scroll view it remains the same.

I think all that is changing is the scaling of the CGLayers. When you zoom in, it shrinks the clipping region frame smaller but then scales the CGLayer transform upwards. In other words, all the logical elements are still present it is simply choosing to draw and display a different part of it.

In the iPhone Application Programming Guide they have a good explanation about the relationship between frames, clipping regions and various transforms on views.

TechZen
A: 

If you are not manually responding to changes in the zoom scale (like I describe in this answer), the view that you return from the -viewForZoomingInScrollView: delegate method is simply having a scaling transform applied to it by the UIScrollView. The frame size of the view is not changing, it is just being graphically transformed (which is why you see blurriness at higher scale factors).

Brad Larson
Ok, i understand. I understand why even after the drawrect is being called, the content is not getting refreshed for the subview and remains blurry as it was earlier. So can you suggest a way by which I will be able to adjust my content to this new enlarged size?
wolverine
@wolverine: If you look at the answer I link to above, I describe a process for responding to changes in the scale factor within a UIScrollView. You will need to have your view redraw itself at the end of the scaling operation by changing the frame, calling -setNeedsDisplay, or doing some other custom Quartz drawing within your view.
Brad Larson