Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhuy committed May 4, 2017
1 parent 2c963c4 commit 994a35c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/CustomCollectionView/Sample/ImageCellNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ - (id)initWithImage:(UIImage *)image

- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
CGSize imageSize = self.image.size;
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsZero
child:[ASRatioLayoutSpec ratioLayoutSpecWithRatio:self.image.size.height/self.image.size.width
child:[ASRatioLayoutSpec ratioLayoutSpecWithRatio:imageSize.height/imageSize.width
child:_imageNode]];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ - (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutConte
ASElementMap *elements = context.elements;
CGFloat top = 0;

// TODO use +[NSMapTable elementToLayoutAttributesTable]
NSMapTable<ASCollectionElement *, UICollectionViewLayoutAttributes *> *attrsMap = [NSMapTable mapTableWithKeyOptions:(NSMapTableObjectPointerPersonality | NSMapTableWeakMemory) valueOptions:NSMapTableStrongMemory];
NSMutableArray *columnHeights = [NSMutableArray array];

Expand Down Expand Up @@ -98,6 +99,7 @@ - (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutConte

attrs.frame = frame;
[attrsMap setObject:attrs forKey:element];
// TODO Profile and avoid boxing if there are significant retain/release overheads
columnHeights[section][columnIndex] = @(CGRectGetMaxY(frame) + _interItemSpacing.bottom);
}

Expand Down

0 comments on commit 994a35c

Please sign in to comment.