Skip to content

Instantly share code, notes, and snippets.

@nguyenhuy
Last active August 29, 2015 14:21
Show Gist options
  • Save nguyenhuy/ac755a421caab9a19340 to your computer and use it in GitHub Desktop.
Save nguyenhuy/ac755a421caab9a19340 to your computer and use it in GitHub Desktop.
- (CKComponent *)layoutComponentThatFits:(CGSize)constrainedSize
{
return [CKInsetComponent
newWithInsets:UIEdgeInsetsMake(kOuterPadding, kOuterPadding, kOuterPadding, kOuterPadding)
component:
[CKStackLayoutComponent
newWithSize:{.maxWidth = constrainedSize.width, .maxHeight = constrainedSize.height}
style:{.direction = CKStackLayoutDirectionHorizontal, .spacing = kInnerPadding} // Change to CKStackLayoutDirectionVertical it will just work!!!
children:{
{
[ASNodeWrappingComponent newWithNode:_imageNode staticSize:CGSizeMake(kImageSize, kImageSize)]
},
{
[ASNodeWrappingComponent newWithNode:_textNode],
.flexShrink = true // Flexbox baby
}
}]];
}
@nguyenhuy
Copy link
Author

yes, this is more like a showcase. The project still needs heavy refactoring. Let's move the discuss to FB group I guess, I didn't get notification here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment