Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ASCollectionLayout] Manually set size to measured cells #24

Merged

Conversation

nguyenhuy
Copy link
Member

@nguyenhuy nguyenhuy commented Apr 18, 2017

(Ported from facebookarchive/AsyncDisplayKit#3262)

Currently, ASDataController sets the calculated size of a cell node right after measuring it (here). This behavior dates all the way back to the first implementation of ASDataController. This is to ensure that by the time the cell needs to display, it has a valid size and the needsLayout flag of its layer is on. Failing to do so will cause it to skip its display pass entirely.

ASCollectionLayout currently doesn't do this which causes some cells to be missing. This PR updates ASCollectionLayout to set the frame whenever a node's layout attributes is asked.

There are 2 other places we can fix this:

When the cell node applies its layout attributes. This event is driven by UICollectionView and is often too late. We want all cell nodes that are not only in visible range but also display and preload ranges to have a correct size.
When the cell node enters preload range: Inside didEnterPreloadState, the node needs to grab its calculated size and assumes that the size is valid. However, I'd prefer ASCollectionLayout to be in charge of these kind of decisions.

Ticket: #186

@CLAassistant
Copy link

CLAassistant commented Apr 18, 2017

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants