目前我正在尝试创建一个UICollectionView,应该显示一个简单的excel-like-spreadsheet,用rows和columns.UICollectionViews我相信,这应该是一件容易的事.而且我真的想要实现UICollectionView,而不是任何grid framework.
但此刻我暂停了一下.我已经想通了,我好遗憾的是不能使用UICollectionViewDelegateFlowLayout的,因为这仅支持scrolling在任一 horizontally或vertically方向.但我需要scrolling双向.
因此我必须使用一个UICollectionViewLayout,但为此我没有找到好的例子,如何使用它.你有没有一个例子,如何子类化UICollectionViewLayout支持rows和columns?
提前致谢.
我有一个iPad应用程序,我正在使用UICollectionView,每个UICollectionViewCell只包含一个UIImage.目前我每页显示每9个UIImages(3行*3列),我有几页.
我想使用Pinch Gesture缩放整个UICollectionView来增加/减少每页显示的行数/列数,最好是在Pinch手势期间获得漂亮的缩放动画!
目前,我在我的UICollectionView上添加了一个Pinch Gesture.我抓住Pinch Gesture事件使用比例因子计算行数/列数,如果它已经改变,那么我使用以下方法更新完整的UICollectionView:
[_theCollectionView performBatchUpdates:^{
[_theCollectionView deleteSections:[NSIndexSet indexSetWithIndex:0]];
[_theCollectionView insertSections:[NSIndexSet indexSetWithIndex:0]];
} completion:nil];
Run Code Online (Sandbox Code Playgroud)
它有效,但在过渡期间我没有平滑的动画.
任何的想法?UICollectionView继承自UIScrollView,是否有可能重用UIScrollView Pinch手势功能来实现我的目标?