Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Owner and Founder. Opencart
Top Partners
In Most of time we use the collection view inside the table view cell if the collection view flow is vertical then we need to increase the height of table view cell or if flow layout is horizontal then we fix some constant height for table view cell .
Here I am discussing about how to manage the table view cell height automatically if collection view flow layout is vertical
Follow the Steps:
1: Go to Table view Cell class & create the outlet of collection view & collection view Height Constraints.
2: Now Register the Collection view cell so we can use .
3: Now write their All delegate & data source method inside the table view cell class.
4: Now the Collection View delegate & data source are set , now move to Table View Delegate & Data source.
5: Now register the tableview cell
6: After register the Tableview Cell & we have to define their delegate & Data source.
7: Now its Time to return the cell , here i am creating the vertical flow of collection view where the collection view height is fixed, so its automatically increase the table view cell size.
8 Notes : these are the important part to automate your table view cell
cell.frame = tableView.bounds
cell.layoutIfNeeded()
cell.prodcutCollectionView.reloadData()
cell.productCollectionViewHeight.constant = cell.prodcutCollectionView.collectionViewLayout.collectionViewContentSize.height
9: Now your Table View Cell automatically increase without calculating the height of each collection view.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
yourTableviewRefrence.reloadDataWithAutoSizingCellWorkAround()
extension UITableView { func reloadDataWithAutoSizingCellWorkAround() { self.reloadData() self.setNeedsLayout() self.layoutIfNeeded() self.reloadData()
} }
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Webkul is a truly trusted and supported IT Company to develop business ideas for e-commerce. They provide professional support after deploying the solution to production and be responsible to act for fixing the reported issues or system errors. We highly encourage to deal with Webkul for business development.
Hussein Zawia
Co-founder, 24Dokan
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.