[ASCellNode] Layout delegate should not be public as it must not be reset externally.

Do not call layout delegate method before the cell node is loaded.  This can happen if
application code calls -setNeedsLayout on the cell manually, and can confuse UIKit state
because we submit an empty batch update call on the next runloop.
This commit is contained in:
Scott Goodson
2016-02-20 15:24:44 -08:00
parent ca8357a364
commit d899f12f70
5 changed files with 27 additions and 22 deletions

View File

@@ -14,19 +14,6 @@ NS_ASSUME_NONNULL_BEGIN
typedef NSUInteger ASCellNodeAnimation;
@protocol ASCellNodeLayoutDelegate <NSObject>
/**
* Notifies the delegate that the specified cell node has done a relayout.
* The notification is done on main thread.
*
* @param node A node informing the delegate about the relayout.
* @param sizeChanged `YES` if the node's `calculatedSize` changed during the relayout, `NO` otherwise.
*/
- (void)nodeDidRelayout:(ASCellNode *)node sizeChanged:(BOOL)sizeChanged;
@end
/**
* Generic cell node. Subclass this instead of `ASDisplayNode` to use with `ASTableView` and `ASCollectionView`.
*/
@@ -71,11 +58,6 @@ typedef NSUInteger ASCellNodeAnimation;
*/
@property (nonatomic, assign) BOOL highlighted;
/*
* A delegate to be notified (on main thread) after a relayout.
*/
@property (nonatomic, weak) id<ASCellNodeLayoutDelegate> layoutDelegate;
/*
* ASCellNode must forward touch events in order for UITableView and UICollectionView tap handling to work. Overriding
* these methods (e.g. for highlighting) requires the super method be called.