Paulo Coutinho
Paulo Coutinho

Reputation: 705

Swift Collection View inside Table View with empty space

I made a swift project open source that is a demo about using Collection View inside Table View Cells.

Everything is working, except a bug in the third cell that has an empty space and i debug it a lot and don't find any solution.

A screenshot:

bug

The project: https://github.com/prsolucoes/TableWithCollection

This issue with a video: https://github.com/prsolucoes/TableWithCollection/issues/1

Can anyone help me?

Thanks.

Upvotes: 0

Views: 211

Answers (1)

omar
omar

Reputation: 291

In ViewController createAll() function, you need to remove this line:

tableView.estimatedRowHeight = max(UIScreen.main.bounds.width, UIScreen.main.bounds.height)

I assume it's setting the first nonvisible row (3) when loading the UITableView with double the height. Because using your code after scrolling and coming back it worked fine.

Upvotes: 1

Related Questions