Margins and spacing work like their HTML/CSS equivalents.
Spacing controls the space between subviews.
Margins control the space between the contents of the WeView (ie. its subviews) and its edges.
Defaults By default, layouts have no margins or spacing.
Convenience methods You can set margins with methods like [WeViewLayout setLeftMargin:] or [WeViewLayout setTopMargin:] or you can set multiple margins at once with methods like [WeViewLayout setHMargin:] (which sets the left and right margins) or [WeViewLayout setMargin:] (which sets all of the margins: top, bottom, left and right). You can set spacing with [WeViewLayout setHSpacing:] or [WeViewLayout setVSpacing:] or set both at once with [WeViewLayout setSpacing:].
Alignment
Layout alignment If a WeView’s layout has extra space, its contents are positioned based on alignment. A WeView layout has separate hAlign (left, center, right) and vAlign (top, center, bottom) properties.
Defaults By default, layouts have center alignment.
Convenience methods. You can set alignment with [WeViewLayout setHAlign:] or [WeViewLayout setVAlign:] or you can set multiple margins at once with methods like [UIView setMargin:].
Don’t confuse Layout Alignment with Cell Alignment. Layout Alignment is a layout property and determines how a layout’s subviews as a whole are aligned within the WeView’s bounds. Cell Alignment is a subview property and determines how a subview is aligned within its layout cell. See the Layout Model section of the tutorial.
Cropping
Layout Alignment and Subview Stretch apply when there is extra space in the WeView’s bounds for layout. There can also be a shortage of space. In this case Subview Stretch also applies. However, if the subviews cannot be stretched to fit inside a WeView, layouts can also optionally crop their subviews to fit inside their bounds. The cropSubviewOverflow layout property controls this behavior.
However, layouts generally should not have a shortage of space so you usually don’t need to worry about this.