fix sometimes call layoutsubviews in cycle
This commit is contained in:
parent
2bf4874467
commit
e53c91c22f
@ -115,10 +115,12 @@ - (void)requestLayout {
|
||||
return;
|
||||
}
|
||||
self.waitingLayout = YES;
|
||||
__weak typeof(self) _self = self;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.waitingLayout = NO;
|
||||
__strong typeof(_self) self = _self;
|
||||
[self sizeToFit];
|
||||
[self layout];
|
||||
self.waitingLayout = NO;
|
||||
});
|
||||
}
|
||||
|
||||
@ -127,6 +129,13 @@ - (void)layoutSubviews {
|
||||
[self requestLayout];
|
||||
}
|
||||
|
||||
- (void)setNeedsLayout {
|
||||
if (self.waitingLayout) {
|
||||
return;
|
||||
}
|
||||
[super setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)layout {
|
||||
[self.subviews enumerateObjectsUsingBlock:^(__kindof UIView *child, NSUInteger idx, BOOL *stop) {
|
||||
if ([child isKindOfClass:[DoricLayoutContainer class]]) {
|
||||
|
Reference in New Issue
Block a user