子视图不会通过捏合手势调整大小

发布于 2024-10-09 08:51:29 字数 425 浏览 4 评论 0原文

我有几个子视图添加到 UIScrollview 中。左右滑动时一切正常,即子视图随着滑动而移动。当我使用捏合手势时,子视图不会与滚动视图的其他内容一起放大和缩小。在上下文中绘制的所有内容都工作正常,但子视图保持相同的大小,但我认为基于其起源的移动而移动,例如在屏幕外伸展时。

我正在调用...

[scrollView setAutoresizesSubviews:YES];

viewDidLoad。 调用了...。

subView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeigh 

我还为添加的每个子视图

我错了什么,或者这不是这样做的方法?

I have several subviews added to a UIScrollview. Every thing works fine when swiping left and right, ie the subviews move with the swipe. When I use the pinch gestures the subviews do not zoom in and out with the other contents of the scrollview. Everything drawn in context works fine but the subviews remain the same size but move I think based on the movement of their origins, off screen for example if pinching out.

I am calling...

[scrollView setAutoresizesSubviews:YES];

on viewDidLoad. I have also called...

subView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeigh 

for each subview added.

What am I dong wrong, or is this not the way to do it?

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

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

发布评论

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

评论(1

帅哥哥的热头脑 2024-10-16 08:51:29

您是否声明了委托函数以在调用视图时调整视图大小?

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;

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

Have you declared the delegate functions to resize the view when it is called ?

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文