iOS: fix when RootNode shrink its size, it cannot be layout properly
This commit is contained in:
parent
f67f0ce75a
commit
4103704162
@ -28,6 +28,8 @@
|
||||
|
||||
@interface DoricRootNode : DoricStackNode
|
||||
|
||||
@property(nonatomic, assign) CGSize mostFrameSize;
|
||||
|
||||
- (void)setupRootView:(UIView *)view;
|
||||
|
||||
@end
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user