本文介绍了如何为UICollectionView启用缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑。我有一个 UICollectionView 。我有自己的 UICollectionViewLayout 子类(喵,我没有使用Flow的东西)。 UICollectionView instance是 UIScrollView 的子类。它添加了多个子视图。但是像这样的问题似乎要说可滚动视图应该只有一个子视图来滚动整个视图。似乎与我的婚姻不一致。我的意思是为什么Apple给我一个制作多子视图的框架,然后将它们全部放在滚动视图中,这不应该运行良好?

I am confused. I have a UICollectionView. I have my own UICollectionViewLayout subclass (iow, I am not using the Flow thing). UICollectionView instance is a subclass of UIScrollView. It adds multiple subviews. But questions like Properly zooming a UIScrollView that contains many subviews seem to say that scrollable views should just have one subview to "scroll the whole view". Seems kind of an inconsistent marriage to me. I mean why does Apple give me a framework for making a multiple child view, and then stick them all in scroll view, which isn't supposed to work well?

所以我很好奇我应该如何制作我的整个 UICollectionView (它位于 UICollectionViewController 子类中)zoomable。我是否需要实现各种委托方法并使布局对象无效/操作,根据我在布局中保留的某些属性派生布局?或者是否有其他机制?

So I'm curious how I should go about making my whole UICollectionView (it's in a UICollectionViewController subclass) zoomable. Do I need to implement various delegate methods and invalidate/manipulate the layout object, deriving the layouts based on some property I keep in my layout? Or is there some other mechanism?

除此之外,为什么它不能只操纵 zoomScale 属性并执行此操作对我来说是自动的?或者我在这里错过了一些微妙之处?

Aside, why can't it just manipulate the zoomScale property and do it automagically for me? Or am I missing some subtlety here?

推荐答案

我不确定我是否以正确的方式提出了你的问题,但我您可能想查看这些链接: -


1。 - 它还有一个指向。您可能有兴趣检查它。

2。 。
3。

I am not sure whether I got your question in correct way or not, but I think you might want to check these links:-

1. zoom entire UICollectionView - It also has a link to Sample code for UICollectionView. You might be interested in checking it.
2. Adding pinch zoom to a UICollectionView.
3. Make UICollectionView zoomable?

希望这会帮助你。

这篇关于如何为UICollectionView启用缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 06:11