ASLayoutSpec Class Reference
| Inherits from | NSObject |
|---|---|
| Conforms to | ASLayoutable |
| Declared in | ASLayoutSpec.h |
isMutable
Creation of a layout spec should only happen by a user in layoutSpecThatFits:. During that method, a layout spec can be created and mutated. Once it is passed back to ASDK, the isMutable flag will be set to NO and any further mutations will cause an assert.
@property (nonatomic, assign) BOOL isMutableDeclared In
ASLayoutSpec.h
– setChild:
Adds a child to this layout spec using a default identifier.
- (void)setChild:(id<ASLayoutable>)childParameters
child |
A child to be added. |
|---|
Discussion
Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the reponsibility of holding on to the spec children. Some layout specs, like ASInsetLayoutSpec, only require a single child.
For layout specs that require a known number of children (ASBackgroundLayoutSpec, for example) a subclass should use this method to set the “primary” child. It can then use setChild:forIdentifier: to set any other required children. Ideally a subclass would hide this from the user, and use the setChild:forIdentifier: internally. For example, ASBackgroundLayoutSpec exposes a backgroundChild property that behind the scenes is calling setChild:forIdentifier:.
Declared In
ASLayoutSpec.h
– setChild:forIdentifier:
Adds a child with the given identifier to this layout spec.
- (void)setChild:(id<ASLayoutable>)child forIdentifier:(NSString *)identifierParameters
child |
A child to be added. |
|---|---|
identifier |
An identifier associated with the child. |
Discussion
Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the reponsibility of holding on to the spec children. Some layout specs, like ASInsetLayoutSpec, only require a single child.
For layout specs that require a known number of children (ASBackgroundLayoutSpec, for example) a subclass should use the setChild method to set the “primary” child. It can then use this method to set any other required children. Ideally a subclass would hide this from the user, and use the setChild:forIdentifier: internally. For example, ASBackgroundLayoutSpec exposes a backgroundChild property that behind the scenes is calling setChild:forIdentifier:.
Declared In
ASLayoutSpec.h
– setChildren:
Adds childen to this layout spec.
- (void)setChildren:(NSArray *)childrenParameters
children |
An array of ASLayoutable children to be added. |
|---|
Discussion
Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the reponsibility of holding on to the spec children. Some layout specs, like ASStackLayoutSpec, can take an unknown number of children. In this case, the this method should be used. For good measure, in these layout specs it probably makes sense to define setChild: and setChild:forIdentifier: methods to do something appropriate or to assert.
Declared In
ASLayoutSpec.h
– child
Returns the child added to this layout spec using the default identifier.
- (id<ASLayoutable>)childDeclared In
ASLayoutSpec.h
– childForIdentifier:
Returns the child added to this layout spec using the given identifier.
- (id<ASLayoutable>)childForIdentifier:(NSString *)identifierParameters
identifier |
An identifier associated withe the child. |
|---|
Declared In
ASLayoutSpec.h
– children
Returns all children added to this layout spec.
- (NSArray *)childrenDeclared In
ASLayoutSpec.h