Update automatic-layout-basics.md

This commit is contained in:
Hannah Troisi
2016-04-07 15:57:34 -07:00
parent 299b972197
commit 3a09d15497

View File

@@ -28,31 +28,7 @@ Every ASLayoutSpec must act on at least one child. The ASLayoutSpec has the resp
You dont need to be aware of **`ASLayout`** except to know that it represents a computed immutable layout tree and is returned by objects conforming to the `<ASLayoutable>` protocol.
##Layout Containers
AsyncDisplayKit includes a library of components that can be composed to declaratively specify a layout. The following LayoutSpecs allow you to have multiple children:
* **ASStackLayoutSpec** is based on a simplified version of CSS flexbox. It allows you to stack components vertically or horizontally and specify how they should be flexed and aligned to fit in the available space.
* **ASStaticLayoutSpec** allows positioning children at fixed offsets.
The following layoutSpecs allow you to layout a single children:
* **ASLayoutSpec** can be used as a spacer if it contains no children
* **ASInsetLayoutSpec** applies an inset margin around a component.
* **ASBackgroundLayoutSpec** lays out a component, stretching another component behind it as a backdrop.
* **ASOverlayLayoutSpec** lays out a component, stretching another component on top of it as an overlay.
* **ASCenterLayoutSpec** centers a component in the available space.
* **ASRatioLayoutSpec** lays out a component at a fixed aspect ratio. Great for images, gifs and videos.
* **ASRelativeLayoutSpec** lays out a component and positions it within the layout bounds according to vertical and horizontal positional specifiers. Similar to the “9-part” image areas, a child can be positioned at any of the 4 corners, or the middle of any of the 4 edges, as well as the center.
##Implementing layoutSpecThatFits:
##Strategy
##Layout for UIKit Components:
- for UIViews that are added directly, you will still need to manually lay it out in `didLoad:`
- for UIViews that are added ASDisplay initWithViewBlock, you can then include it in `layoutSpecThatFits:`
##Debugging with ASCII Art
##Legacy Layout Methods