Add ASAbsoluteLayoutSpecSizing (#2394)

Add ability for ASAbsoluteLayoutSpec to grow as far as possible or shrink to fit it's children
This commit is contained in:
Michael Schneider
2016-10-18 13:55:13 -07:00
committed by GitHub
parent 6fcbf642c9
commit 56d50e6d5e
2 changed files with 47 additions and 9 deletions

View File

@@ -10,15 +10,32 @@
#import <AsyncDisplayKit/ASLayoutSpec.h>
/** How much space the spec will take up. */
typedef NS_ENUM(NSInteger, ASAbsoluteLayoutSpecSizing) {
/** The spec will take up the maximum size possible. */
ASAbsoluteLayoutSpecSizingDefault,
/** Computes a size for the spec that is the union of all childrens' frames. */
ASAbsoluteLayoutSpecSizingSizeToFit,
};
NS_ASSUME_NONNULL_BEGIN
/**
* A layout spec that positions children at fixed positions.
*
* Computes a size that is the union of all childrens' frames.
A layout spec that positions children at fixed positions.
*/
@interface ASAbsoluteLayoutSpec : ASLayoutSpec
/**
How much space will the spec taken up
*/
@property (nonatomic, assign) ASAbsoluteLayoutSpecSizing sizing;
/**
@param sizing How much space the spec will take up
@param children Children to be positioned at fixed positions
*/
+ (instancetype)absoluteLayoutSpecWithSizing:(ASAbsoluteLayoutSpecSizing)sizing children:(NSArray<id<ASLayoutElement>> *)children AS_WARN_UNUSED_RESULT;
/**
@param children Children to be positioned at fixed positions
*/