Skip to content

[ASCollectionLayout] Manually set size to measured cells#24

Merged
Adlai-Holler merged 2 commits into
TextureGroup:masterfrom
nguyenhuy:HNMissingCellsInCollectionLayout
Apr 19, 2017
Merged

[ASCollectionLayout] Manually set size to measured cells#24
Adlai-Holler merged 2 commits into
TextureGroup:masterfrom
nguyenhuy:HNMissingCellsInCollectionLayout

Conversation

@nguyenhuy

@nguyenhuy nguyenhuy commented Apr 18, 2017

Copy link
Copy Markdown
Member

(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

@nguyenhuy
nguyenhuy requested a review from Adlai-Holler April 18, 2017 11:31
@CLAassistant

CLAassistant commented Apr 18, 2017

Copy link
Copy Markdown

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.

3 participants