mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
[Layout] Extract layout implementation code into it's own subcategories (#272)
* Extract layout code into ASDisplayNode categories * Category renaming and documentation * Changelog * Change header
This commit is contained in:
committed by
GitHub
parent
299df0aa8c
commit
b32e69d64b
@@ -295,44 +295,6 @@ extern NSInteger const ASDefaultDrawingPriority;
|
||||
*/
|
||||
@property (nonatomic, class, copy) ASDisplayNodeNonFatalErrorBlock nonFatalErrorBlock;
|
||||
|
||||
|
||||
/** @name Managing dimensions */
|
||||
|
||||
/**
|
||||
* @abstract Provides a way to declare a block to provide an ASLayoutSpec without having to subclass ASDisplayNode and
|
||||
* implement layoutSpecThatFits:
|
||||
*
|
||||
* @return A block that takes a constrainedSize ASSizeRange argument, and must return an ASLayoutSpec that includes all
|
||||
* of the subnodes to position in the layout. This input-output relationship is identical to the subclass override
|
||||
* method -layoutSpecThatFits:
|
||||
*
|
||||
* @warning Subclasses that implement -layoutSpecThatFits: must not also use .layoutSpecBlock. Doing so will trigger
|
||||
* an exception. A future version of the framework may support using both, calling them serially, with the
|
||||
* .layoutSpecBlock superseding any values set by the method override.
|
||||
*
|
||||
* @code ^ASLayoutSpec *(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) {};
|
||||
*/
|
||||
@property (nonatomic, readwrite, copy, nullable) ASLayoutSpecBlock layoutSpecBlock;
|
||||
|
||||
/**
|
||||
* @abstract Return the calculated size.
|
||||
*
|
||||
* @discussion Ideal for use by subclasses in -layout, having already prompted their subnodes to calculate their size by
|
||||
* calling -measure: on them in -calculateLayoutThatFits.
|
||||
*
|
||||
* @return Size already calculated by -calculateLayoutThatFits:.
|
||||
*
|
||||
* @warning Subclasses must not override this; it returns the last cached measurement and is never expensive.
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) CGSize calculatedSize;
|
||||
|
||||
/**
|
||||
* @abstract Return the constrained size range used for calculating layout.
|
||||
*
|
||||
* @return The minimum and maximum constrained sizes used by calculateLayoutThatFits:.
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) ASSizeRange constrainedSizeForCalculatedLayout;
|
||||
|
||||
/** @name Managing the nodes hierarchy */
|
||||
|
||||
|
||||
@@ -589,7 +551,7 @@ extern NSInteger const ASDefaultDrawingPriority;
|
||||
/**
|
||||
* Convenience methods for debugging.
|
||||
*/
|
||||
@interface ASDisplayNode (Debugging) <ASLayoutElementAsciiArtProtocol, ASDebugNameProvider>
|
||||
@interface ASDisplayNode (Debugging) <ASDebugNameProvider>
|
||||
|
||||
/**
|
||||
* @abstract Return a description of the node hierarchy.
|
||||
@@ -600,7 +562,6 @@ extern NSInteger const ASDefaultDrawingPriority;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* ## UIView bridge
|
||||
*
|
||||
@@ -763,7 +724,52 @@ extern NSInteger const ASDefaultDrawingPriority;
|
||||
|
||||
@end
|
||||
|
||||
@interface ASDisplayNode (LayoutTransitioning)
|
||||
@interface ASDisplayNode (ASLayoutElementAsciiArtProtocol) <ASLayoutElementAsciiArtProtocol>
|
||||
@end
|
||||
|
||||
@interface ASDisplayNode (ASLayout)
|
||||
|
||||
/** @name Managing dimensions */
|
||||
|
||||
/**
|
||||
* @abstract Provides a way to declare a block to provide an ASLayoutSpec without having to subclass ASDisplayNode and
|
||||
* implement layoutSpecThatFits:
|
||||
*
|
||||
* @return A block that takes a constrainedSize ASSizeRange argument, and must return an ASLayoutSpec that includes all
|
||||
* of the subnodes to position in the layout. This input-output relationship is identical to the subclass override
|
||||
* method -layoutSpecThatFits:
|
||||
*
|
||||
* @warning Subclasses that implement -layoutSpecThatFits: must not also use .layoutSpecBlock. Doing so will trigger
|
||||
* an exception. A future version of the framework may support using both, calling them serially, with the
|
||||
* .layoutSpecBlock superseding any values set by the method override.
|
||||
*
|
||||
* @code ^ASLayoutSpec *(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) {};
|
||||
*/
|
||||
@property (nonatomic, readwrite, copy, nullable) ASLayoutSpecBlock layoutSpecBlock;
|
||||
|
||||
/**
|
||||
* @abstract Return the calculated size.
|
||||
*
|
||||
* @discussion Ideal for use by subclasses in -layout, having already prompted their subnodes to calculate their size by
|
||||
* calling -measure: on them in -calculateLayoutThatFits.
|
||||
*
|
||||
* @return Size already calculated by -calculateLayoutThatFits:.
|
||||
*
|
||||
* @warning Subclasses must not override this; it returns the last cached measurement and is never expensive.
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) CGSize calculatedSize;
|
||||
|
||||
/**
|
||||
* @abstract Return the constrained size range used for calculating layout.
|
||||
*
|
||||
* @return The minimum and maximum constrained sizes used by calculateLayoutThatFits:.
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) ASSizeRange constrainedSizeForCalculatedLayout;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@interface ASDisplayNode (ASLayoutTransitioning)
|
||||
|
||||
/**
|
||||
* @abstract The amount of time it takes to complete the default transition animation. Default is 0.2.
|
||||
@@ -837,7 +843,7 @@ extern NSInteger const ASDefaultDrawingPriority;
|
||||
/*
|
||||
* ASDisplayNode support for automatic subnode management.
|
||||
*/
|
||||
@interface ASDisplayNode (AutomaticSubnodeManagement)
|
||||
@interface ASDisplayNode (ASAutomaticSubnodeManagement)
|
||||
|
||||
/**
|
||||
* @abstract A boolean that shows whether the node automatically inserts and removes nodes based on the presence or
|
||||
|
||||
Reference in New Issue
Block a user