最小规模为0.5
的最大规模为2.0
The maximum scale is 2.0
我需要经常使用较大的 contentSize
为的UIScrollView
来能够拖动周围的内容。因此,随着 CGRect
的内容正在发生变化, contentSize
的的UIScrollView
也在发生变化。
I need to always use larger contentSize
for UIScrollView
to be able to drag around the content. So, as the CGRect
of the content is changing, contentSize
of UIScrollView
is also changing.
不过,正如我缩小,但规模会低于1.0, contentOffset
急剧变化为{0.0,0.0},使得它很难调整内容而保持它的位置,以覆盖视图(如衣图像)。
However, as I zoom out, if the scale is going below 1.0, contentOffset
is abruptly changed to {0.0, 0.0}, making it very difficult to resize the content while keep it's position to the overlay view (e.g. a clothe image).
在换句话说,我不能让内容视图更小,同时保持它位于中心的UIScrollView
。
In other words, I can't make the content view smaller while keeping it positioned at the center of the UIScrollView
.
请帮我找到合适的方式来使用放大/缩小与的UIScrollView
,同时保持了内容视图的位置。
Please help me to find the right way to use zoom in/out with UIScrollView
while keeping the position of the content view.
该解决方案的,而不是基本上是关于使用 contentInset
在初始设置保持在中心的内容, contentOffset
。随着 contentInset
是未经修饰的,放大或缩小的对象可以是在该中心所有的时间。
The solutions is basically about using contentInset
at initial setup to keep the content at the center, instead of contentOffset
. With contentInset
being unmodified, zoomed in or out object can be at the center all the time.