[ASDisplayNode] Trigger a layout pass whenever a node enters preload state (#3263)

* Add a thread-safe layoutIfNeeded implementation to ASDisplayNode

* Trigger a layout pass when a display node enters preload state
- This ensures that all the subnodes have the correct size to preload their content.

* ASCollectionNode to trigger its initial data load when it enters preload state

* Minor change in _ASCollectionViewCell

* Layout sublayouts before dispatch to main for subclass hooks

* Update comments

* Don't wait until updates are committed when the collection node enters display state

* Same deal for table node

* Explain the layout trigger in ASDisplayNode
This commit is contained in:
Huy Nguyen
2017-04-14 00:25:17 +01:00
committed by Adlai Holler
parent 3164d8d013
commit dcf858eac1
8 changed files with 124 additions and 44 deletions

View File

@@ -639,6 +639,11 @@ extern NSInteger const ASDefaultDrawingPriority;
*/
- (void)setNeedsLayout;
/**
* Performs a layout pass on the node. Convenience for use whether the view / layer is loaded or not. Safe to call from a background thread.
*/
- (void)layoutIfNeeded;
@property (nonatomic, strong, nullable) id contents; // default=nil
@property (nonatomic, assign) BOOL clipsToBounds; // default==NO
@property (nonatomic, getter=isOpaque) BOOL opaque; // default==YES