fix:iOS DoricListNode exception and DoricGroupNode exception
This commit is contained in:
parent
90a3691362
commit
eabb98cee9
@ -77,7 +77,11 @@ - (void)configChildNodes {
|
|||||||
viewNode.viewId = viewId;
|
viewNode.viewId = viewId;
|
||||||
[viewNode initWithSuperNode:self];
|
[viewNode initWithSuperNode:self];
|
||||||
[viewNode blend:model[@"props"]];
|
[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];
|
[self.view insertSubview:viewNode.view atIndex:idx];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -95,9 +99,16 @@ - (void)configChildNodes {
|
|||||||
DoricViewNode *reused = childNodes[(NSUInteger) position];
|
DoricViewNode *reused = childNodes[(NSUInteger) position];
|
||||||
[childNodes removeObjectAtIndex:(NSUInteger) position];
|
[childNodes removeObjectAtIndex:(NSUInteger) position];
|
||||||
[childNodes removeObjectAtIndex:idx];
|
[childNodes removeObjectAtIndex:idx];
|
||||||
[childNodes insertObject:reused atIndex:idx];
|
if (idx >= childNodes.count) {
|
||||||
[childNodes insertObject:oldNode atIndex:(NSUInteger) position];
|
[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
|
///View swap index
|
||||||
[reused.view removeFromSuperview];
|
[reused.view removeFromSuperview];
|
||||||
[oldNode.view removeFromSuperview];
|
[oldNode.view removeFromSuperview];
|
||||||
@ -109,7 +120,11 @@ - (void)configChildNodes {
|
|||||||
viewNode.viewId = viewId;
|
viewNode.viewId = viewId;
|
||||||
[viewNode initWithSuperNode:self];
|
[viewNode initWithSuperNode:self];
|
||||||
[viewNode blend:model[@"props"]];
|
[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];
|
[self.view insertSubview:viewNode.view atIndex:idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +138,11 @@ - (void)configChildNodes {
|
|||||||
viewNode.viewId = viewId;
|
viewNode.viewId = viewId;
|
||||||
[viewNode initWithSuperNode:self];
|
[viewNode initWithSuperNode:self];
|
||||||
[viewNode blend:model[@"props"]];
|
[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];
|
[self.view insertSubview:viewNode.view atIndex:idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,4 @@ - (void)initWithSuperNode:(DoricSuperNode *)superNode {
|
|||||||
[super initWithSuperNode:superNode];
|
[super initWithSuperNode:superNode];
|
||||||
self.reusable = YES;
|
self.reusable = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)requestLayout {
|
|
||||||
[self.view.doricLayout apply];
|
|
||||||
[super requestLayout];
|
|
||||||
}
|
|
||||||
@end
|
@end
|
||||||
|
@ -145,6 +145,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
|
|||||||
DoricListItemNode *node = cell.doricListItemNode;
|
DoricListItemNode *node = cell.doricListItemNode;
|
||||||
node.viewId = model[@"id"];
|
node.viewId = model[@"id"];
|
||||||
[node blend:props];
|
[node blend:props];
|
||||||
|
[node.view.doricLayout apply:CGSizeMake(tableView.width, tableView.height)];
|
||||||
[node requestLayout];
|
[node requestLayout];
|
||||||
[self callItem:position height:node.view.height];
|
[self callItem:position height:node.view.height];
|
||||||
return cell;
|
return cell;
|
||||||
@ -220,7 +221,7 @@ - (void)blendSubNode:(NSDictionary *)subModel {
|
|||||||
|
|
||||||
- (void)callItem:(NSUInteger)position height:(CGFloat)height {
|
- (void)callItem:(NSUInteger)position height:(CGFloat)height {
|
||||||
NSNumber *old = self.itemHeights[@(position)];
|
NSNumber *old = self.itemHeights[@(position)];
|
||||||
if (old && old.floatValue == height) {
|
if (old && [old isEqualToNumber:@(height)]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.itemHeights[@(position)] = @(height);
|
self.itemHeights[@(position)] = @(height);
|
||||||
|
Reference in New Issue
Block a user