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
|
@interface DoricRootNode : DoricStackNode
|
||||||
|
|
||||||
|
@property(nonatomic, assign) CGSize mostFrameSize;
|
||||||
|
|
||||||
- (void)setupRootView:(UIView *)view;
|
- (void)setupRootView:(UIView *)view;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -54,13 +54,25 @@ - (void)setY:(CGFloat)y {
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation DoricRootNode
|
@implementation DoricRootNode
|
||||||
|
|
||||||
|
- (instancetype)initWithContext:(DoricContext *)doricContext {
|
||||||
|
if (self = [super initWithContext:doricContext]) {
|
||||||
|
_mostFrameSize = CGSizeZero;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setupRootView:(UIView *)view {
|
- (void)setupRootView:(UIView *)view {
|
||||||
view.doricLayout.layoutType = DoricStack;
|
view.doricLayout.layoutType = DoricStack;
|
||||||
self.view = view;
|
self.view = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)requestLayout {
|
- (void)requestLayout {
|
||||||
|
if (CGSizeEqualToSize(self.mostFrameSize, CGSizeZero)) {
|
||||||
[self.view.doricLayout apply];
|
[self.view.doricLayout apply];
|
||||||
|
} else {
|
||||||
|
[self.view.doricLayout apply:self.mostFrameSize];
|
||||||
|
}
|
||||||
[super requestLayout];
|
[super requestLayout];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user