ASLayoutSpec are temporarily mutable and have a more obj-c interface

This commit is contained in:
rcancro
2015-08-21 16:02:36 -07:00
parent 60cf43766b
commit c06a6be188
27 changed files with 357 additions and 168 deletions

View File

@@ -76,14 +76,14 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName";
#if UseAutomaticLayout
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
return
[ASInsetLayoutSpec
newWithInsets:UIEdgeInsetsMake(kTextPadding, kTextPadding, kTextPadding, kTextPadding)
child:
[ASCenterLayoutSpec
newWithCenteringOptions:ASCenterLayoutSpecCenteringX // Center the text horizontally
sizingOptions:ASCenterLayoutSpecSizingOptionMinimumY // Takes up minimum height
child:_textNode]];
ASCenterLayoutSpec *centerSpec = [[ASCenterLayoutSpec alloc] init];
centerSpec.centeringOptions = ASCenterLayoutSpecCenteringX;
centerSpec.sizingOptions = ASCenterLayoutSpecSizingOptionMinimumY;
centerSpec.child = _textNode;
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(kTextPadding, kTextPadding, kTextPadding, kTextPadding)
child:centerSpec];
}
#else
- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize