Skip to content

Instantly share code, notes, and snippets.

@andrei4002
Created January 29, 2017 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrei4002/575ba2095f143555d7cba097655dbd88 to your computer and use it in GitHub Desktop.
Save andrei4002/575ba2095f143555d7cba097655dbd88 to your computer and use it in GitHub Desktop.
ASDK - some errors - how to fix?
- (ASLayoutSpec *) layoutSpecThatFits:(ASSizeRange)constrainedSize {
CGFloat ratio = 9.0/16.0;
self.iconImageNode.style.preferredSize = CGSizeMake(16, 16);
self.userAvatarImageNode.style.preferredSize = CGSizeMake(48, 48);
self.userNameNode.style.flexShrink = 1;
ASStackLayoutSpec *displayUnitPayloadStack =
[ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical
spacing:4
justifyContent:ASStackLayoutJustifyContentStart
alignItems:ASStackLayoutAlignItemsStart
children:@[
[ASRatioLayoutSpec ratioLayoutSpecWithRatio:ratio child:_topImageNode],
[[ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal
spacing:4
justifyContent:ASStackLayoutJustifyContentStart
alignItems:ASStackLayoutAlignItemsCenter
children:@[_iconImageNode, _iconTitleNode]
] withHorizontalPadding:4],
[self.descriptionNode withHorizontalPadding:4]
]
];
ASStackLayoutSpec *usernameAndDisplayUnitVertical =
[ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical
spacing:8
justifyContent:ASStackLayoutJustifyContentStart
alignItems:ASStackLayoutAlignItemsStart
children:@[
_userNameNode,
displayUnitPayloadStack
]
];
usernameAndDisplayUnitVertical.style.flexShrink = 1.0;
ASStackLayoutSpec *avatarAndUsernameHorizontal =
[ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal
spacing:8
justifyContent:ASStackLayoutJustifyContentStart
alignItems:ASStackLayoutAlignItemsStart
children:@[
_userAvatarImageNode,
usernameAndDisplayUnitVertical
]
];
ASInsetLayoutSpec *spec = [avatarAndUsernameHorizontal withPadding:UIEdgeInsetsMake(40, 8, 8, 80)];
return spec;
}
Cannot calculate size of node: constrainedSize is infinite and node does not override -calculateSizeThatFits: or specify a preferredSize. Try setting style.preferredSize. Node: <<ASNetworkImageNode: 0x7fc67d085c00; debugName = _topImageNode> alpha:1.00 isLayerBacked:0 frame:{{0, 0}, {0, 0}} (null)>
--------------------------------------------------------------ASInsetLayoutSpec-------------------------------------------------------------
| -----------------------------------------------------------ASStackLayoutSpec---------------------------------------------------------- |
| | -----------------------------------ASStackLayoutSpec---------------------------------- | |
| | | ASTextNode"_userNameNode" | | |
| | | --------------------------------ASStackLayoutSpec------------------------------- | | |
| | | | --------ASRatioLayoutSpec (0.6)-------- | | | |
| | | | | ASNetworkImageNode"_topImageNode" | | | | |
| | | | --------------------------------------- | | | |
| | | | -----------------------------ASInsetLayoutSpec---------------------------- | | | |
| | | | | --------------------------ASStackLayoutSpec------------------------- | | | | |
| | ASNetworkImageNode"_userAvatarImageNode" | | | | ASNetworkImageNode"_iconImageNode" ASTextNode"_iconTitleNode" | | | | | |
| | | | | -------------------------------------------------------------------- | | | | |
| | | | -------------------------------------------------------------------------- | | | |
| | | | ---------ASInsetLayoutSpec-------- | | | |
| | | | | ASTextNode"_descriptionNode" | | | | |
| | | | ---------------------------------- | | | |
| | | -------------------------------------------------------------------------------- | | |
| | -------------------------------------------------------------------------------------- | |
| -------------------------------------------------------------------------------------------------------------------------------------- |
--------------------------------------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment