UIScrollView最小比例问题

发布于 2024-07-30 12:46:46 字数 644 浏览 2 评论 0原文

我在进行缩放操作时遇到了 UIScrollView 的问题,这似乎很简单,但我不知道如何解决它。

我希望 UIScrollView 在缩小时不超出内容视图的边界。 通过阅读参考指南,我发现了以下属性:

  • ounces(一个布尔值,控制滚动视图是否弹过内容边缘并再次返回。)
  • bouncesZoom(一个布尔值,确定滚动视图在以下情况下是否对内容缩放进行动画处理)缩放超出最大或最小限制。)
  • alwaysBounceVertical(一个布尔值,确定当垂直滚动到达内容末尾时是否始终发生弹跳。)
  • alwaysBounceHorizo​​ntal(一个布尔值,确定当水平滚动到达末尾时是否始终发生弹跳)内容视图的内容。)

这些属性实际上的作用是定义当滚动视图超出内容视图(缩小太多)时应该执行的操作。 它尝试将属性:

  • minimumZoomScale(指定可应用于滚动视图内容的最小比例因子的浮点值。)设置

为1.0(我猜这是默认值),并且正如预期的那样,滚动视图确实它,但它仍然超出了内容视图的边界一段时间(弹回到最小比例)。

我怎样才能避免这种情况? 可能上述属性的某种组合可能有效,但我对此仍然有点困惑。

提前致谢。

I'm having a problem with the UIScrollView when doing zooming operations, which seems to be very simple but I didn't figured out how to solve it.

I want an UIScrollView no to exceed the bounds of the content view when zooming out.
By reading the Reference Guide i found out the following properties:

  • bounces (A Boolean value that controls whether the scroll view bounces past the edge of content and back again.)
  • bouncesZoom (A Boolean value that determines whether the scroll view animates the content scaling when the scaling exceeds the maximum or minimum limits.)
  • alwaysBounceVertical (A Boolean value that determines whether bouncing always occurs when vertical scrolling reaches the end of the content.)
  • alwaysBounceHorizontal (A Boolean value that determines whether whether bouncing always occurs when horizontal scrolling reaches the end of the content view.)

What these properties actually do is to define what the scroll view should do when the it exceeds the content view (zooms out too much).
It tried setting the property:

  • minimumZoomScale (A floating-point value that specifies the minimum scale factor that can be applied to the scroll view's content.)

to 1.0 (which I guess is the default value), and as expected, the scroll view does it, but it still exceeding the bounds of the content view for a while (bouncing back to the minimum scale).

How can I avoid this? May be some kind of combination of the above properties might work, but I'm still be bit confused about this.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離人涙 2024-08-06 12:46:46

将bouncesZoom 设置为 false。 这应该禁止缩放超过最小缩放值。

Set bouncesZoom to false. This should prohibit zooming pass the minimum zoom value.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文