如何将故事板视图添加到cell.contentView?

时间:2015-04-08 19:33:47

标签: ios uicollectionview uistoryboard

- (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的单元格中。 但我不确定如何以编程方式执行此操作。

1 个答案:

答案 0 :(得分:0)

[cell.contentView addSubview: rowVC.view];
相关问题