mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Clean up #468:
- -layoutSpecThatFits: must return an ASLayoutSpec. - Move ASDisplayNode's -measureWithSizeRange: redeclaration to ASDisplayNode.h. - Rename ASStackLayoutChild.h to ASStackLayoutDefines.h. - Rename ASStaticLayoutSpecDimension.h to ASRelativeSize.h. - Don't import ASLayout.h in other headers to prevent circular inclusions. - Explain use cases of ASLayout's initializers. - Clean up ASInternalHelpers.h.
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#import <AsyncDisplayKit/ASDealloc2MainObject.h>
|
||||
#import <AsyncDisplayKit/ASDimension.h>
|
||||
|
||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
||||
|
||||
typedef UIView *(^ASDisplayNodeViewBlock)();
|
||||
typedef CALayer *(^ASDisplayNodeLayerBlock)();
|
||||
|
||||
@@ -32,7 +34,7 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
|
||||
*
|
||||
*/
|
||||
|
||||
@interface ASDisplayNode : ASDealloc2MainObject
|
||||
@interface ASDisplayNode : ASDealloc2MainObject <ASLayoutable>
|
||||
|
||||
|
||||
/** @name Initializing a node object */
|
||||
@@ -137,6 +139,23 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
|
||||
*/
|
||||
- (CGSize)measure:(CGSize)constrainedSize;
|
||||
|
||||
/**
|
||||
* @abstract Asks the node to measure a layout based on given size range.
|
||||
*
|
||||
* @param constrainedSize The minimum and maximum sizes the receiver should fit in.
|
||||
*
|
||||
* @return An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used).
|
||||
*
|
||||
* @discussion Though this method does not set the bounds of the view, it does have side effects--caching both the
|
||||
* constraint and the result.
|
||||
*
|
||||
* @warning Subclasses must not override this; it caches results from -calculateLayoutThatFits:. Calling this method may
|
||||
* be expensive if result is not cached.
|
||||
*
|
||||
* @see [ASDisplayNode(Subclassing) calculateLayoutThatFits:]
|
||||
*/
|
||||
- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize;
|
||||
|
||||
/**
|
||||
* @abstract Return the calculated size.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user