- (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的单元格中。 但我不确定如何以编程方式执行此操作。
答案 0 :(得分:0)
[cell.contentView addSubview: rowVC.view];