0

I am working with collectionview inside tableviewcell in Swift 4. I get the content from server which is all dynamic. I have to show different types of collectionview behaviours.

For example, in the first tableview row should be collectionviewcell with screenwidth and scrollable. In the second row, collectionview with 3 sections and each section has different content different number of items.

Here I got stuck I am unable to show 3 sections one below other it is showing besides horizontally. I have calculated collectionview flow layout size.

Also in last row I have collectonviewcell with scrollable content,here when i scoll the content is repeating from bottom row or top row. I want the smoth scrolling and to stop repeating the content.

I am new to Swift. Can anybody help me out of this . Thanks in advance.

V.S
  • 59
  • 5
  • Possible duplicate of [UICollectionView inside a UITableViewCell -- dynamic height?](https://stackoverflow.com/questions/24126708/uicollectionview-inside-a-uitableviewcell-dynamic-height) – Arpit Kulsreshtha Sep 12 '18 at 06:06

1 Answers1

0

The smooth way is to create tableview with its cell xib and inside its cell add collection view and create another xib for collection view cell. This method is helpful when accessing collection view for different tableview cell. Rather using without loading Xib's may mixup your code.

  • You have to set tableview cell height as UITableViewAutomaticDimension. This will handle your cell height as per your dynamic content.
  • For each tableview cell you have to set collection view's property by using cell's index path as per your requirement.