Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Improve Our Handling of Flow Layout Headers/Footers#2939

Merged
Adlai-Holler merged 8 commits intomasterfrom
AHChangeFlowLayoutSupplementarySupport
Jan 27, 2017
Merged

Improve Our Handling of Flow Layout Headers/Footers#2939
Adlai-Holler merged 8 commits intomasterfrom
AHChangeFlowLayoutSupplementarySupport

Conversation

@Adlai-Holler
Copy link
Copy Markdown
Contributor

@Adlai-Holler Adlai-Holler commented Jan 27, 2017

This is valuable in general, and critical for our support for flow layout headers/footers under IGListKit.

Before this diff:

  • Layout talked directly to our delegate about referenceSizeForHeader
  • So if you return { 320, 100 }, the layout will make the header 100 tall.
  • But flow layout inspector will constrain the header node to { {320, 0}, {320, 100} } when measuring.
  • So if your node ends up being 80 tall, then the view it's placed in will be 100 tall but the node will only be 80 tall.
  • Our documentation incorrectly states that insetForSectionAtIndex: does nothing. It doesn't do nothing! Flow layout calls this directly and uses it to layout items.

After this diff:

  • ASColllectionView will intercept the referenceSizeForHeader call, and return the calculated size for the header node, so they always match up.
  • If the delegate continues to implement it, the layout inspector will call referenceSizeForHeaderInSection: to get an exact size constraint for the header.
  • Add a new method referenceSizeRangeForHeader which is preferred, so the client doesn't have to know the exact header size.
  • Add ASSizeRangeZero and ASSizeRangeUnconstrained constants.

@Adlai-Holler Adlai-Holler merged commit 295ed22 into master Jan 27, 2017
@Adlai-Holler Adlai-Holler deleted the AHChangeFlowLayoutSupplementarySupport branch January 27, 2017 23:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants