Add custom collection view layout example project

This commit is contained in:
Levi McCallum
2015-11-23 14:01:54 -08:00
parent c1539bda6e
commit 36d24950e0
51 changed files with 1482 additions and 3 deletions

View File

@@ -0,0 +1,37 @@
//
// ImageCellNode.m
// Sample
//
// Created by McCallum, Levi on 11/22/15.
// Copyright (c) 2015 Facebook. All rights reserved.
//
#import "ImageCellNode.h"
@implementation ImageCellNode {
ASImageNode *_imageNode;
}
- (id)initWithImage:(UIImage *)image
{
self = [super init];
if (self != nil) {
_imageNode = [[ASImageNode alloc] init];
_imageNode.image = image;
[self addSubnode:_imageNode];
}
return self;
}
- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
{
[_imageNode measure:constrainedSize];
return constrainedSize;
}
- (void)layout
{
_imageNode.frame = CGRectMake(0, 0, _imageNode.calculatedSize.width, _imageNode.calculatedSize.height);
}
@end