开发者

What is actually changing when we zoom out a subView inside a UIScrollView?

开发者 https://www.devze.com 2022-12-22 01:36 出处:网络
I have a subview inside a uiscrollview. Then I zoom i开发者_C百科t out. So it becomes bigger and allows me to scroll through it.

I have a subview inside a uiscrollview. Then I zoom i开发者_C百科t out. So it becomes bigger and allows me to scroll through it.

So what is actually changing here? ContentSize of UIScrollView?


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).


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号