【问题标题】:Resize all uiscrollviews in a container uiscrollview调整容器 uiscrollview 中所有 uiscrollview 的大小
【发布时间】:2013-09-23 22:03:32
【问题描述】:

Hierarchy 是一个全屏横向容器 UIScroll。内部是多个由 uiscrollviews 组成的全屏页面,其中包含图像 - 这允许分页以及内部滚动视图的捏合/缩放。您可以上下滚动。

我想调整容器滚动视图的宽度,并让嵌套的 uiscrolls 和其中的图像按比例动态调整到新的宽度和高度。

我的外卷轴自动调整大小为是,我的内卷轴也一样。我也有我的 uiimageviews 在 auto 上。

现在容器滚动的框架只是裁剪掉内部内容。

有什么想法吗?

【问题讨论】:

    标签: uiscrollview resize autoresizingmask


    【解决方案1】:

    我最终向一个函数添加了代码,该函数允许我按照我想要的方式缩放滚动视图的内部。

     [containerscrollView setFrame:CGRectMake(200.0f, 0.0f, 800.0f, 768.0f)];
                             containerscrollView.contentSize = CGSizeMake(800,containerscrollView.frame.size.height * scrollArrayCount);
                             for (UIScrollView *tmp in [containerscrollView subviews]) {
                                 if (tmp.tag>4000) // make sure to only resize the inner scrollview {
                                     [tmp setFrame:CGRectMake(tmp.frame.origin.x, tmp.frame.origin.y, 800.0f, 768.0f)];
                                     _innerScrollView.contentSize =CGSizeMake(800.0f, 768.0f);
                                 }
                             }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多