diff --git a/docs/_docs/automatic-layout-examples-2.md b/docs/_docs/automatic-layout-examples-2.md index 07da8df13..71dd04cbc 100755 --- a/docs/_docs/automatic-layout-examples-2.md +++ b/docs/_docs/automatic-layout-examples-2.md @@ -130,7 +130,7 @@ override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec To create this layout, we will use a: -- `ASAbsoluteLayoutSpec` to place the photo and icon which have been individually sized and positioned using their `ASLayoutable` properties +- `ASCornerLayoutSpec` to position the icon in corner of the photo
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{
- _iconNode.style.preferredSize = CGSizeMake(40, 40);
- _iconNode.style.layoutPosition = CGPointMake(150, 0);
-
+ _iconNode.style.preferredSize = CGSizeMake(40, 40);
_photoNode.style.preferredSize = CGSizeMake(150, 150);
- _photoNode.style.layoutPosition = CGPointMake(40 / 2.0, 40 / 2.0);
-
- return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithSizing:ASAbsoluteLayoutSpecSizingSizeToFit
- children:@[_photoNode, _iconNode]];
+
+ return [ASCornerLayoutSpec cornerLayoutSpecWithChild:_photoNode corner:_iconNode location:ASCornerLayoutLocationTopRight];
}