fix sometimes call layoutsubviews while in layout

This commit is contained in:
pengfei.zhou 2019-11-01 19:22:57 +08:00
parent e53c91c22f
commit 30c381ca08

View File

@ -124,16 +124,19 @@ - (void)requestLayout {
}); });
} }
- (void)layoutSubviews {
[super layoutSubviews];
[self requestLayout];
}
- (void)setNeedsLayout { - (void)setNeedsLayout {
[super setNeedsLayout];
if (self.waitingLayout) { if (self.waitingLayout) {
return; return;
} }
[super setNeedsLayout]; [self requestLayout];
}
- (BOOL)waitingLayout {
if ([self.superview isKindOfClass:[DoricLayoutContainer class]]) {
return [(DoricLayoutContainer *) self.superview waitingLayout];
}
return _waitingLayout;
} }
- (void)layout { - (void)layout {