fix:iOS DoricListNode exception and DoricGroupNode exception

This commit is contained in:
pengfei.zhou
2020-06-22 15:12:00 +08:00
committed by osborn
parent 90a3691362
commit eabb98cee9
3 changed files with 27 additions and 12 deletions

View File

@@ -77,7 +77,11 @@ - (void)configChildNodes {
viewNode.viewId = viewId;
[viewNode initWithSuperNode:self];
[viewNode blend:model[@"props"]];
[childNodes insertObject:viewNode atIndex:idx];
if (idx >= childNodes.count) {
[childNodes addObject:viewNode];
} else {
[childNodes insertObject:viewNode atIndex:idx];
}
[self.view insertSubview:viewNode.view atIndex:idx];
}
} else {
@@ -95,9 +99,16 @@ - (void)configChildNodes {
DoricViewNode *reused = childNodes[(NSUInteger) position];
[childNodes removeObjectAtIndex:(NSUInteger) position];
[childNodes removeObjectAtIndex:idx];
[childNodes insertObject:reused atIndex:idx];
[childNodes insertObject:oldNode atIndex:(NSUInteger) position];
if (idx >= childNodes.count) {
[childNodes addObject:reused];
} else {
[childNodes insertObject:reused atIndex:idx];
}
if (position >= childNodes.count) {
[childNodes addObject:oldNode];
} else {
[childNodes insertObject:oldNode atIndex:(NSUInteger) position];
}
///View swap index
[reused.view removeFromSuperview];
[oldNode.view removeFromSuperview];
@@ -109,7 +120,11 @@ - (void)configChildNodes {
viewNode.viewId = viewId;
[viewNode initWithSuperNode:self];
[viewNode blend:model[@"props"]];
[childNodes insertObject:viewNode atIndex:idx];
if (idx >= childNodes.count) {
[childNodes addObject:viewNode];
} else {
[childNodes insertObject:viewNode atIndex:idx];
}
[self.view insertSubview:viewNode.view atIndex:idx];
}
}
@@ -123,7 +138,11 @@ - (void)configChildNodes {
viewNode.viewId = viewId;
[viewNode initWithSuperNode:self];
[viewNode blend:model[@"props"]];
[childNodes insertObject:viewNode atIndex:idx];
if (idx >= childNodes.count) {
[childNodes addObject:viewNode];
} else {
[childNodes insertObject:viewNode atIndex:idx];
}
[self.view insertSubview:viewNode.view atIndex:idx];
}
}