[ASCellNode] Apply layout delegate behavior in -__setNeedsLayout, not -setNeedsLayout

This commit is contained in:
Adlai Holler
2016-04-21 14:41:01 -05:00
parent e3aa2230f2
commit ea777456b6
2 changed files with 7 additions and 13 deletions

View File

@@ -34,6 +34,10 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) {
/**
* Generic cell node. Subclass this instead of `ASDisplayNode` to use with `ASTableView` and `ASCollectionView`.
* @note When a cell node is contained inside a collection view (or table view),
* calling `-setNeedsLayout` will also notify the collection on the main thread
* so that the collection can update its item layout if the cell's size changed.
*/
@interface ASCellNode : ASDisplayNode
@@ -85,17 +89,6 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) {
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER;
- (void)touchesCancelled:(nullable NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER;
/**
* Marks the node as needing layout. Convenience for use whether the view / layer is loaded or not.
*
* If this node was measured, calling this method triggers an internal relayout: the calculated layout is invalidated,
* and the supernode is notified or (if this node is the root one) a full measurement pass is executed using the old constrained size.
* The delegate will then be notified on main thread.
*
* This method can be called inside of an animation block (to animate all of the layout changes).
*/
- (void)setNeedsLayout;
/**
* @abstract Initializes a cell with a given view controller block.
*