0

我想要一個UICollectionView,其中的單元也是UICollectionView s。這是可能的,如果是這樣,有人可以給我一個指導如何開始這個?我已經有我的主要UICollectionView,但我在執行其UICollectionViewUICollectionViewCell時遇到問題。在UICollectionViewCell中實現UICollectionView

+1

你在想什麼,具體是什麼?什麼不起作用,具體是什麼? – nhgrif

回答

0

我前段時間做了類似的事情。在您的父級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; 
} 
相關問題