From ff92ac5b16de12b139f59156e8005dfddb645b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Fri, 11 Aug 2023 20:19:03 +0800 Subject: [PATCH] iOS: when cell height not zero don't remove --- doric-iOS/Pod/Classes/Shader/DoricListNode.m | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/doric-iOS/Pod/Classes/Shader/DoricListNode.m b/doric-iOS/Pod/Classes/Shader/DoricListNode.m index 056e8dd2..1e1bf9ce 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricListNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricListNode.m @@ -174,7 +174,13 @@ - (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id [self removeSubModel:obj]; }]; [self.itemViewIds removeAllObjects]; - [self.itemHeights removeAllObjects]; + NSMutableDictionary *map = self.itemHeights.mutableCopy; + [self.itemHeights enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, NSNumber *obj, BOOL * _Nonnull stop) { + if ([obj isEqualToNumber:@(0)]) { + [map removeObjectForKey:key]; + } + }]; + self.itemHeights = map.mutableCopy; self.needReload = true; } } else if ([@"batchCount" isEqualToString:name]) { @@ -724,7 +730,13 @@ - (void)reload { [self removeSubModel:obj]; }]; [self.itemViewIds removeAllObjects]; - [self.itemHeights removeAllObjects]; + NSMutableDictionary *map = self.itemHeights.mutableCopy; + [self.itemHeights enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, NSNumber *obj, BOOL * _Nonnull stop) { + if ([obj isEqualToNumber:@(0)]) { + [map removeObjectForKey:key]; + } + }]; + self.itemHeights = map.mutableCopy; dispatch_async(dispatch_get_main_queue(), ^{ self.rowCount = self.itemCount + (self.loadMore ? 1 : 0); [self.view reloadData];