Customize cell "TableViewCell" .xib with a collectionViewCell inside

0

I have a class TableViewCell with your file .xib . In the cell that appears in .xib I add a collectionView inside.

How can I reference or use the collectionView of this TableView cell to make use of the cells within the collectionView ?

Inside the function awakeFromNib() I try to do the following:

 self.collectionView.register(UINib.init(nibName: "CollectionViewCell",bundle: Bundle.main), forCellReuseIdentifier: "menu_collection_cell") 

But I get the error:

  

"Can not invoke 'register' with an argument list of type '(UINibm forCellReuseIdentifier: String)"

    
asked by Popularfan 26.09.2017 в 11:48
source

1 answer

1

Let's say that what you are trying to do is possible, although perhaps in the eyes of many it could be considered crazy. Still, I'll answer your question.

To make a CollectionView within a cell work, the Delagate and DataSource of said CollectionView must be implemented within the class of the cell, and here the madness.

For this the register must be within the awakeFromNib of the cell.

    
answered by 16.10.2017 в 16:31