feat:step 4
This commit is contained in:
		| @@ -94,17 +94,8 @@ - (CGSize)measureSize:(CGSize)targetSize { | ||||
|  * layout self and subviews | ||||
|  * */ | ||||
| - (void)layoutSelf:(CGSize)targetSize { | ||||
|     CGSize contentSize = [self sizeThatFits:targetSize]; | ||||
|     if (self.layoutConfig.widthSpec == DoricLayoutAtMost) { | ||||
|         self.width = targetSize.width; | ||||
|     } else if (self.layoutConfig.widthSpec == DoricLayoutWrapContent) { | ||||
|         self.width = contentSize.width; | ||||
|     } | ||||
|     if (self.layoutConfig.heightSpec == DoricLayoutAtMost) { | ||||
|         self.height = targetSize.height; | ||||
|     } else if (self.layoutConfig.heightSpec == DoricLayoutWrapContent) { | ||||
|         self.height = contentSize.height; | ||||
|     } | ||||
|     self.width = targetSize.width; | ||||
|     self.height = targetSize.height; | ||||
| } | ||||
| 
 | ||||
| - (BOOL)requestSuperview { | ||||
| @@ -167,6 +158,10 @@ @interface DoricLayoutContainer () | ||||
| @end | ||||
| 
 | ||||
| @implementation DoricLayoutContainer | ||||
| - (void)setNeedsLayout { | ||||
|     [super setNeedsLayout]; | ||||
| } | ||||
| 
 | ||||
| - (void)layoutSubviews { | ||||
|     [super layoutSubviews]; | ||||
|     [self doricLayoutSubviews]; | ||||
| @@ -294,8 +289,6 @@ - (CGSize)sizeThatFits:(CGSize)size { | ||||
| 
 | ||||
| - (void)layoutSelf:(CGSize)targetSize { | ||||
|     [super layoutSelf:targetSize]; | ||||
|     self.width = targetSize.width; | ||||
|     self.height = targetSize.height; | ||||
|     CGFloat yStart = 0; | ||||
|     if ((self.gravity & TOP) == TOP) { | ||||
|         yStart = 0; | ||||
|   | ||||
| @@ -41,9 +41,14 @@ - (CGSize)sizeThatFits:(CGSize)size { | ||||
| 
 | ||||
| - (void)layoutSelf:(CGSize)targetSize { | ||||
|     [super layoutSelf:targetSize]; | ||||
|     [self.contentView layoutSelf: [self.contentView sizeThatFits:targetSize]]; | ||||
|     [self.contentView layoutSelf:[self.contentView sizeThatFits:targetSize]]; | ||||
|     [self setContentSize:self.contentView.frame.size]; | ||||
| } | ||||
| 
 | ||||
| - (CGSize)measureSize:(CGSize)targetSize { | ||||
|     CGSize size = [super measureSize:targetSize]; | ||||
|     return CGSizeMake(MIN(targetSize.width, size.width), MIN(targetSize.height, size.height)); | ||||
| } | ||||
| @end | ||||
| 
 | ||||
| @interface DoricScrollerNode () | ||||
|   | ||||
		Reference in New Issue
	
	Block a user