【问题标题】:How to add a storyboard view into a cell.contentView?如何将情节提要视图添加到 cell.contentView 中?
【发布时间】:2015-04-08 19:33:46
【问题描述】:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"TNCNewsRow" bundle:nil];
    TNCNewsRowViewController *rowVC = (TNCNewsRowViewController*)[storyboard instantiateViewControllerWithIdentifier:@"storyboard2"];
    NSArray *news = [_news objectAtIndex:indexPath.section];
    rowVC.news = news;
    cell.contentView  = rowVC;  // ??
    return cell;
}

我正在尝试将 CollectionViewB 添加到另一个 CollectionViewA 的单元格中。 但我不确定如何以编程方式执行此操作。

【问题讨论】:

    标签: ios uicollectionview uistoryboard


    【解决方案1】:
    [cell.contentView addSubview: rowVC.view];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-05
      • 2014-07-12
      • 1970-01-01
      • 2012-07-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多