Flexbox 布局
主要思想是,通过Flex容器设定的属性来改变内部Flex项目的宽,高,并调整flex项目的位置来填充flex容器的可用空间。
Texture 框架
提供了一个基类ASLayoutSpec, 在这个基础类上提供了各种功能
1 2 3 4 5 6 7 8 9 10
| ASAbsoluteLayoutSpec ASBackgroundLayoutSpec ASInsetLayoutSpec ASOverlayLayoutSpec ASRatioLayoutSpec ASRelativeLayoutSpec ASCenterLayoutSpec ASStackLayoutSpec ASWrapperLayoutSpec ASCornerLayoutSpec
|
ASLayoutSpec 遵守ASLayoutElement协议
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| @protocol ASLayoutElement <ASLayoutElementExtensibility, ASTraitEnvironment, ASLayoutElementAsciiArtProtocol>
#pragma mark - Getter
@property (nonatomic, readonly) ASLayoutElementType layoutElementType; @property (nonatomic, readonly) ASLayoutElementStyle *style; - (nullable NSArray<id<ASLayoutElement>> *)sublayoutElements;
#pragma mark - Calculate layout
- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize;
- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize parentSize:(CGSize)parentSize;
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize;
- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize restrictedToSize:(ASLayoutElementSize)size relativeToParentSize:(CGSize)parentSize;
- (BOOL)implementsLayoutMethod;
@end
|