Labinot Bajrami
Labinot Bajrami

Reputation: 425

Dynamic Collection View Cell with TableView inside?

i have added a TableView inside Collection View Cell, but the Collection View Cell height should depend on TableView data.

Thanks.

Upvotes: 1

Views: 425

Answers (1)

Rakshith Nandish
Rakshith Nandish

Reputation: 639

Maybe this can be achieved by reloading the tableview first, waiting for it complete, fetch the tableview Content height then load the collectionview giving the cell the right values

tableView.reloadData()
        dispatch_async(dispatch_get_main_queue(), { () -> Void in
            requiredCellHeight = self.tableView.contentSize.height
        })

This waits on the main thread for the tableview to load. Though not an ideal solution as we are blocking the main thread, might work for this complex setup

Upvotes: 2

Related Questions