AsyncDisplayKit icon indicating copy to clipboard operation
AsyncDisplayKit copied to clipboard

ASCellNode with shouldRasterizeDescendants does not call layout() on subnodes.

Open ajk198 opened this issue 11 years ago • 5 comments

Hi,

I have a class that extends ASCellNode that sets shouldRasterizeDescendants to true. When adding a subnode to the class, layout() is never called on the subnode.

Is this intended or is there something I'm doing wrong? calculateSizeThatFits() on the subnode is called and so is drawRect(). If I call layout() manually in the cell node's layout() method, everything works fine.

ajk198 avatar May 21 '15 20:05 ajk198

@ajk198 Thanks for the report — I think this is a real issue. Because shouldRasterize being YES allows the system to avoid allocating any layers or views for that tree (can be a huge savings), there aren't any backing objects to call layout. This was not a problem for Paper's layout system, but clearly is for most apps!

The workaround you described is completely safe, and essentially the same thing that a system fix will do. We just need to install -layout calls in the logic that already recursively visits each node during rasterization.

appleguy avatar Jun 14 '15 21:06 appleguy

Thanks for getting back to me. I can imagine with as many animations as Paper uses, you wouldn't be able to use shouldRasterizeDescendants as much as a more "static" app.

ajk198 avatar Jun 17 '15 18:06 ajk198

@ajk198 that is a very correct observation that many people don't realize ;).

FWIW, with the current PR in flight relating to layout mechanics, this has a real chance of being fixed soon. It will not be that terribly hard to add a recursive "-layoutIfNeeded" sort of call to rasterized hierarchies.

appleguy avatar Jun 23 '15 05:06 appleguy

This has ben fixed.

appleguy avatar Dec 18 '15 04:12 appleguy

@ajk198 Sorry it took a long time to update this task - the bug was fixed quite some time ago. Please feel free to try the latest ASDK release (master is best at the moment) and please do file a new issue for any problems you encounter, whether related to this or otherwise!

appleguy avatar Dec 18 '15 04:12 appleguy