【问题标题】:Implement UICollectionView in a UICollectionViewCell在 UICollectionViewCell 中实现 UICollectionView
【发布时间】:2014-01-15 22:35:19
【问题描述】:

我想要一个UICollectionView,其中的单元格也是UICollectionViews。这可能吗?如果可以,有人可以给我一个关于如何开始的指南吗?我已经有了我的主要UICollectionView,但在其UICollectionViewCell 中实现另一个UICollectionView 时遇到了麻烦。

【问题讨论】:

  • 您具体在尝试什么?具体是什么问题?

标签: ios objective-c cocoa-touch uicollectionview uicollectionviewcell


【解决方案1】:

前段时间我做过类似的事情。在您的父 CollectionView 的 cellForItemAtIndexPath: 内,您必须执行以下操作。我没有对此进行测试,因此您可能需要添加一些代码:

ChildCollectionViewController * cv = //Initialize your secondCVController here
  if (!cv) {
    cv = [self.storyboard instantiateViewControllerWithIdentifier:@"collectionViewID”]; //set your class’s storyboard ID before doing this

    cv.view.frame = cell.contentView.bounds;
    [self addChildViewController:cv];
    [cell.contentView addSubview:cv.view];
    [cv didMoveToParentViewController:self];
}
 //Some code here for cell contents

return cell;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-29
    • 1970-01-01
    相关资源
    最近更新 更多