Closed DingSoung closed 7 years ago
I fixed by get the array of items to expand
example
+ (NSArray<Model*> * _Nullable)subModelsWithUniqueID:(NSString * _Nullable)uniqueID models:(NSArray<Model *> * _Nullable)models {
for (Model *model in models) {
if ([uniqueID isEqualToString:model.uniqueID]) {
return @[model];
}
}
for (Model *model in models) {
NSArray<Model *> *subModels = [Model subModelsWithUniqueID:uniqueID models:model.subModels];
if (subModels) {
return [@[model] arrayByAddingObjectsFromArray: subModels];
}
}
return nil;
}
NSArray<Model *> *models = [Model subModelsWithUniqueID:model.uniqueID models:_self.models];
for (int i = 0; i < models.count; i++) {
[_self.treeView expandRowForItem:models[i] expandChildren:NO withRowAnimation:RATreeViewRowAnimationAutomatic];
}
for example, expand to 3.2 directly, not expand 1 then 2.2