【问题标题】:Convert UIScrollView contentOffset and contentSize to layer position and bounds properties将 UIScrollView contentOffset 和 contentSize 转换为图层位置和边界属性
【发布时间】:2014-02-13 16:16:18
【问题描述】:

我有一个全屏显示的UIScrollView,其中包含一个填充滚动视图的contentViewUIImageView。我添加了一个方法来注册滚动视图的contentOffsetcontentSize 在特定的平移和缩放。

我正在尝试将这些坐标转换为CALayer,我可以使用positionbounds 对其进行动画处理,以便为平移设置动画并缩放到所需的点。

如何将UIScrollViewcontentOffsetcontentSize 转换为CALayer boundsposition 属性。 CALayer 的屏幕大小为CALayer,并添加到另一个屏幕大小为CALayer

【问题讨论】:

    标签: ios iphone uiscrollview uikit


    【解决方案1】:

    看来我只需要提出问题才能最终回答我自己的问题!

    CALayeranchorPoint设置为CGPointZero

    然后将bounds 的大小设置为contentSize

    position 设置为负数contentOffset {-contentOffset.x,-contentOffset.y}

    终于。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-25
      • 2011-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多