CKStackLayoutComponent Class Reference
Inherits from | CKComponent : NSObject |
---|---|
Declared in | CKStackLayoutComponent.h |
Overview
A simple layout component that stacks a list of children vertically or horizontally.
- All children are initially laid out with the an infinite available size in the stacking direction.
- In the other direction, this component’s constraint is passed.
- The children’s sizes are summed in the stacking direction.
- If this sum is less than this component’s minimum size in stacking direction, children with flexGrow are flexed.
- If it is greater than this component’s maximum size in the stacking direction, children with flexShrink are flexed.
- If, even after flexing, the sum is still greater than this component’s maximum size in the stacking direction, justifyContent determines how children are laid out.
For example:
- Suppose stacking direction is Vertical, min-width=100, max-width=300, min-height=200, max-height=500.
- All children are laid out with min-width=100, max-width=300, min-height=0, max-height=INFINITY.
- If the sum of the childrens' heights is less than 200, components with flexGrow are flexed larger.
- If the sum of the childrens' heights is greater than 500, components with flexShrink are flexed smaller.
Each component is shrunk by ((sum of heights) - 500)/(number of components)
.
- If the sum of the childrens' heights is greater than 500 even after flexShrink-able components are flexed,
justifyContent determines how children are laid out.
+ newWithView:size:style:children:
A view configuration, or {} for no view.
+ (instancetype)newWithView:(const CKComponentViewConfiguration &)view size:(const CKComponentSize &)size style:(const CKStackLayoutComponentStyle &)style children:(const std : : vector<CKStackLayoutComponentChild> &)children
Parameters
view |
A view configuration, or {} for no view. |
---|---|
size |
A size, or {} for the default size. |
style |
Specifies how children are laid out. |
children |
A vector of children components. |
Declared In
CKStackLayoutComponent.h