diff --git a/doric-iOS/Pod/Classes/Shader/DoricRootNode.h b/doric-iOS/Pod/Classes/Shader/DoricRootNode.h index 6a210cd2..13301e0d 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricRootNode.h +++ b/doric-iOS/Pod/Classes/Shader/DoricRootNode.h @@ -28,6 +28,8 @@ @interface DoricRootNode : DoricStackNode +@property(nonatomic, assign) CGSize mostFrameSize; + - (void)setupRootView:(UIView *)view; @end diff --git a/doric-iOS/Pod/Classes/Shader/DoricRootNode.m b/doric-iOS/Pod/Classes/Shader/DoricRootNode.m index 960ab886..37073ab9 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricRootNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricRootNode.m @@ -54,13 +54,25 @@ - (void)setY:(CGFloat)y { @end @implementation DoricRootNode + +- (instancetype)initWithContext:(DoricContext *)doricContext { + if (self = [super initWithContext:doricContext]) { + _mostFrameSize = CGSizeZero; + } + return self; +} + - (void)setupRootView:(UIView *)view { view.doricLayout.layoutType = DoricStack; self.view = view; } - (void)requestLayout { - [self.view.doricLayout apply]; + if (CGSizeEqualToSize(self.mostFrameSize, CGSizeZero)) { + [self.view.doricLayout apply]; + } else { + [self.view.doricLayout apply:self.mostFrameSize]; + } [super requestLayout]; } @end