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


video





Full code is available here to download.

Thanks to this awesome answer.

Comments

  1. Thanks for sharing. All you proportion with us is up to date and quite informative; I would really like to bookmark the page so I can come here again to read you, as you've got finished a first rate job. I’ve the enjoy with one provider custom dissertation writing provider , it's miles very proper and beneficial to writing enhancing and formatting essay report also offers completely unique enjoy of essay writing for the scholars.
    web link

    ReplyDelete

Post a Comment

Popular posts from this blog

Exception Handling - Objective C

Vector graphics in iOS

How to show activity indicator in watch kit