gpt4 book ai didi

ios - UIScrollView.contentSize 似乎随着缩放而增长

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:23:37 25 4
gpt4 key购买 nike

所以我的 scrollView 的 contentSize 最初等于我的图像的框架,但似乎我缩放得越多,contentSize 就越大。因此,当 scrollView 放大时,它周围有一个巨大的间隙。动态更新 - (void)scrollViewDidZoom:(UIScrollView *)aScrollView 中的 contentSize 似乎不起作用。我错过了什么吗?

注意:间隙仅在垂直方向可见(即:imageView 的上方和下方)

最佳答案

我不认为可以在缩放 时动态更新contentSize。这是因为:

A scroll view also handles zooming and panning of content. As the user makes a pinch-in or pinch-out gesture, the scroll view adjusts the offset and the scale of the content. When the gesture ends, the object managing the content view should should update subviews of the content as necessary. (Note that the gesture can end and a finger could still be down.) While the gesture is in progress, the scroll view does not send any tracking calls to the subview.

(Apple docs)

您应该根据zoomScale更新您的contentSize用户完成缩放后使用:

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView 
withView:(UIView *)view
atScale:(float)scale

关于ios - UIScrollView.contentSize 似乎随着缩放而增长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11785613/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com