mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-29 04:05:35 +08:00
ASLayoutSpec are temporarily mutable and have a more obj-c interface
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user