ASLayout Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | ASLayout.h |
position
Position in parent. Default to CGPointNull.
@property (nonatomic, readwrite) CGPoint positionDiscussion
When being used as a sublayout, this property must not equal CGPointNull.
Declared In
ASLayout.h
sublayouts
Array of ASLayouts. Each must have a valid non-null position.
@property (nonatomic, readonly) NSArray *sublayoutsDeclared In
ASLayout.h
+ layoutWithLayoutableObject:size:position:sublayouts:
Initializer.
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject size:(CGSize)size position:(CGPoint)position sublayouts:(NSArray *)sublayoutsParameters
layoutableObject |
The backing ASLayoutable object. |
|---|---|
size |
The size of this layout. |
position |
The posiion of this layout within its parent (if available). |
sublayouts |
Sublayouts belong to the new layout. |
Declared In
ASLayout.h
+ layoutWithLayoutableObject:size:sublayouts:
Convenience initializer that has CGPointNull position. Best used by ASDisplayNode subclasses that are manually creating a layout for -calculateLayoutThatFits:, or for ASLayoutSpec subclasses that are referencing the “self” level in the layout tree, or for creating a sublayout of which the position is yet to be determined.
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject size:(CGSize)size sublayouts:(NSArray *)sublayoutsParameters
layoutableObject |
The backing ASLayoutable object. |
|---|---|
size |
The size of this layout. |
sublayouts |
Sublayouts belong to the new layout. |
Declared In
ASLayout.h
+ layoutWithLayoutableObject:size:
Convenience that has CGPointNull position and no sublayouts. Best used for creating a layout that has no sublayouts, and is either a root one or a sublayout of which the position is yet to be determined.
+ (instancetype)layoutWithLayoutableObject:(id<ASLayoutable>)layoutableObject size:(CGSize)sizeParameters
layoutableObject |
The backing ASLayoutable object. |
|---|---|
size |
The size of this layout. |
Declared In
ASLayout.h
– flattenedLayoutUsingPredicateBlock:
Evaluates a given predicate block against each object in the receiving layout tree and returns a new, 1-level deep layout containing the objects for which the predicate block returns true.
- (ASLayout *)flattenedLayoutUsingPredicateBlock:(BOOL ( ^ ) ( ASLayout *evaluatedLayout ))predicateBlockParameters
predicateBlock |
The block is applied to a layout to be evaluated. The block takes 1 argument: evaluatedLayout - the layout to be evaluated. The block returns YES if evaluatedLayout evaluates to true, otherwise NO. |
|---|
Return Value
A new, 1-level deep layout containing the layouts for which the predicate block returns true.
Declared In
ASLayout.h