使UICollectionView可缩放? [英] Make UICollectionView zoomable?
问题描述
是否有任何方法使 UICollectionView
zoomable
,即当你捏时,所有单元格都可以放大
我可以在 UIScrollView
中通过返回<的唯一子视图
来实现code> UIScrollView 来自委托
方法
Is there any method make the UICollectionView
zoomable
, i.e. when you pinch, all the cells can be zoomed in and out.
I can implement this in UIScrollView
by returning the only subview
of the UIScrollView
from delegate
method
- (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView
自 UICollectionView
是一种 UIScrollView
,有没有办法或解决这个问题? UICollectionView
是否有一个包含所有单元格的直接子视图?
谢谢
Since UICollectionView
is kind of UIScrollView
, is there a way or work around to implement this? Does the UICollectionView
has one direct subview that contains all cells?
Thanks
推荐答案
我认为您所要求的内容看起来像在 WWDC1012
视频 高级馆藏视图和构建自定义布局 (演示于20:20开始)。
I think what you're asking for looks like what is done in the WWDC1012
video entitled Advanced Collection Views and Building Custom Layouts (demo starts at 20:20).
您基本上必须将 pinchGesture
添加到 UICollectionView
,然后传递捏合属性
(缩放,居中)到 UICollectionViewLayout
(这是子类
UICollectionViewFlowLayout
),您的布局将执行 zoom $ c> c>所需的
转换
code>在所需的单元格上。
You basically have to add pinchGesture
to you UICollectionView
, then pass the pinch properties
(scale, center) to the UICollectionViewLayout
(which is a subclass
of UICollectionViewFlowLayout
), your layout will then perform the transformations
needed to zoom
on the desired cell.
这篇关于使UICollectionView可缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!