diff --git a/iOS/Pod/Classes/Shader/DoricLayouts.m b/iOS/Pod/Classes/Shader/DoricLayouts.m index a806496c..883c1625 100644 --- a/iOS/Pod/Classes/Shader/DoricLayouts.m +++ b/iOS/Pod/Classes/Shader/DoricLayouts.m @@ -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; diff --git a/iOS/Pod/Classes/Shader/DoricScrollerNode.m b/iOS/Pod/Classes/Shader/DoricScrollerNode.m index 28848f0d..da6f763c 100644 --- a/iOS/Pod/Classes/Shader/DoricScrollerNode.m +++ b/iOS/Pod/Classes/Shader/DoricScrollerNode.m @@ -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 ()