Skip to main content

Posts

Showing posts from June, 2016

Collection view inside table view with NO vertical scrolling

UICollectionView inside a UITableViewCell — dynamic height? Given the following structure: TableView TableViewCell CollectionView CollectionViewCell CollectionViewCell CollectionViewCell [...variable number of cells or different cell sizes] The solution is to tell auto layout to compute first the collectionViewCell sizes, then the collection view contentSize, and use it as the size of your cell. This is the UIView method that "does the magic": -( void )systemLayoutSizeFittingSize:( CGSize )targetSize       withHorizontalFittingPriority:( UILayoutPriority )horizontalFittingPriority             verticalFittingPriority:( UILayoutPriority )verticalFittingPriority Full code is available here to download . Thanks to this awesome answer .