【发布时间】:2016-04-07 10:50:50
【问题描述】:
我遇到了在同一个 UIViewController 中的 UICollectionView 中同时使用垂直和水平滚动方向的问题。
到目前为止,我所做的首先是一个 UICollectionView。在 UICollectionView 顶部,我有一个 Collection Reusable View。我的解决方案是在可重用视图中实现另一个 UICollectionView,但在运行项目时出错。
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'the view returned from -collectionView:viewForSupplementaryElementOfKind:atIndexPath (UICollectionElementKindSectionHeader,<NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}) was not retrieved by calling -dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath: or is nil ((null))
所以我实际上在一个 UIViewController 中以相同的 Delegate 和 Datasource 方法处理两个不同的 CollectionView。
使用 UITablewView 构建它是更好的方法吗?比将 collectionviews 添加到不同的 UITableViewCells 吗?还是从一个 UIScrollView 开始,然后向滚动视图添加两个不同的 UICollectionView 更好?
【问题讨论】:
标签: ios objective-c xcode uicollectionview