iOS: fix loadMore's change may cause UITableView internal inconsistency,add reloadData action

This commit is contained in:
pengfei.zhou 2022-06-23 17:09:54 +08:00 committed by osborn
parent e5a59dad69
commit 8e021133bb
2 changed files with 12 additions and 4 deletions

View File

@ -240,7 +240,11 @@ - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValu
} else if ([@"loadMoreView" isEqualToString:name]) { } else if ([@"loadMoreView" isEqualToString:name]) {
self.loadMoreViewId = prop; self.loadMoreViewId = prop;
} else if ([@"loadMore" isEqualToString:name]) { } else if ([@"loadMore" isEqualToString:name]) {
self.loadMore = [prop boolValue]; BOOL loadMore = [prop boolValue];
if (loadMore != self.loadMore) {
self.loadMore = loadMore;
[self.view reloadData];
}
} else if ([@"onScroll" isEqualToString:name]) { } else if ([@"onScroll" isEqualToString:name]) {
self.onScrollFuncId = prop; self.onScrollFuncId = prop;
} else if ([@"onScrollEnd" isEqualToString:name]) { } else if ([@"onScrollEnd" isEqualToString:name]) {

View File

@ -103,7 +103,7 @@ - (UITableView *)build {
}]; }];
} }
-(void)longPressAction:(UILongPressGestureRecognizer *)sender{ - (void)longPressAction:(UILongPressGestureRecognizer *)sender {
CGPoint locationInView = [sender locationInView:self.view]; CGPoint locationInView = [sender locationInView:self.view];
NSIndexPath *indexPath = [self.view indexPathForRowAtPoint:locationInView]; NSIndexPath *indexPath = [self.view indexPathForRowAtPoint:locationInView];
if (sender.state == UIGestureRecognizerStateBegan) { if (sender.state == UIGestureRecognizerStateBegan) {
@ -117,7 +117,7 @@ -(void)longPressAction:(UILongPressGestureRecognizer *)sender{
NSString *toValue = self.itemViewIds[@(indexPath.row)]; NSString *toValue = self.itemViewIds[@(indexPath.row)];
self.itemViewIds[@(self.currentDragIndexPath.row)] = toValue; self.itemViewIds[@(self.currentDragIndexPath.row)] = toValue;
self.itemViewIds[@(indexPath.row)] = fromValue; self.itemViewIds[@(indexPath.row)] = fromValue;
[self.view moveRowAtIndexPath:self.currentDragIndexPath toIndexPath:indexPath]; [self.view moveRowAtIndexPath:self.currentDragIndexPath toIndexPath:indexPath];
if (self.onDraggingFuncId != nil) { if (self.onDraggingFuncId != nil) {
[self callJSResponse:self.onDraggingFuncId, @(self.currentDragIndexPath.row), @(indexPath.row), nil]; [self callJSResponse:self.onDraggingFuncId, @(self.currentDragIndexPath.row), @(indexPath.row), nil];
@ -156,7 +156,11 @@ - (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id
} else if ([@"loadMoreView" isEqualToString:name]) { } else if ([@"loadMoreView" isEqualToString:name]) {
self.loadMoreViewId = prop; self.loadMoreViewId = prop;
} else if ([@"loadMore" isEqualToString:name]) { } else if ([@"loadMore" isEqualToString:name]) {
self.loadMore = [prop boolValue]; BOOL loadMore = [prop boolValue];
if (loadMore != self.loadMore) {
self.loadMore = loadMore;
[self.view reloadData];
}
} else if ([@"onScroll" isEqualToString:name]) { } else if ([@"onScroll" isEqualToString:name]) {
self.onScrollFuncId = prop; self.onScrollFuncId = prop;
} else if ([@"onScrollEnd" isEqualToString:name]) { } else if ([@"onScrollEnd" isEqualToString:name]) {