Merge pull request #1766 from hannahmbanana/collectionLayout

[ASCollectionView, ASCellNode] Add support applyLayoutAttributes: on ASCellNode
This commit is contained in:
Michael Schneider
2016-06-23 15:09:10 -07:00
committed by GitHub
3 changed files with 17 additions and 0 deletions

View File

@@ -99,6 +99,13 @@ 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;
/**
* Called by the system when ASCellNode is used with an ASCollectionNode. It will not be called by ASTableNode.
* When the UICollectionViewLayout object returns a new UICollectionViewLayoutAttributes object, the corresponding ASCellNode will be updated.
* See UICollectionViewCell's applyLayoutAttributes: for a full description.
*/
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes;
/**
* @abstract Initializes a cell with a given view controller block.
*

View File

@@ -211,6 +211,11 @@
#pragma clang diagnostic pop
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
// To be overriden by subclasses
}
- (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame
{
// To be overriden by subclasses

View File

@@ -58,6 +58,11 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
_node.highlighted = highlighted;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
[_node applyLayoutAttributes:layoutAttributes];
}
@end
#pragma mark -