0

我有一个画廊页面,我想在其中拥有 12 个独立滚动的独特 CollectionView。我可以这样做,但我也希望它们作为一个组垂直滚动。似乎他们需要在 tableCell 中。但我似乎无法让它发挥作用。我正在使用故事板。所以问题是如何将 CollectionView 的输出放入 tableCell 中,每个 tableRow 都保存一个唯一的 CollectionView。

这是让 collectionView 水平和独立滑动的技巧。每一个都被“标记”。现在我也只需要垂直。

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath: (NSIndexPath *)indexPath {

NSLog(@">>> Entering %s <<<", __PRETTY_FUNCTION__);

if (cv.tag == 0) {
MyCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"CELL" forIndexPath:indexPath];

UIImage *theImage = [UIImage imageNamed:[flowerImages objectAtIndex:indexPath.item]];
cell.imageView.image = theImage;

return cell;
} else if (cv.tag == 1) {
MyCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"CELL2" forIndexPath:indexPath];

UIImage *theImage = [UIImage imageNamed:[carImages objectAtIndex:indexPath.item]];
cell.imageView.image = theImage;

return cell;
} else {
MyCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"CELL3" forIndexPath:indexPath];

UIImage *theImage = [UIImage imageNamed:[birdImages objectAtIndex:indexPath.item]];
cell.imageView.image = theImage;

return cell;

  }
}
4

1 回答 1

0

好的,我最终使用了静态表格单元格。工作!

于 2013-09-20T20:49:46.113 回答