fix: iOS load more view abnormal when item count zero

This commit is contained in:
王劲鹏 2021-07-08 11:28:32 +08:00 committed by osborn
parent 98f2d29cee
commit 800365645c

View File

@ -174,6 +174,7 @@ - (instancetype)initWithContext:(DoricContext *)doricContext {
_itemSizeInfo = [NSMutableDictionary new];
_batchCount = 15;
_columnCount = 2;
_loadAnchor = -1;
}
return self;
}
@ -344,13 +345,13 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
DoricFlowLayoutItemNode *node = cell.viewNode;
node.viewId = model[@"id"];
[node blend:props];
if (position > 0 && position >= self.itemCount) {
if (position >= self.itemCount) {
node.view.width = collectionView.width;
} else {
node.view.width = (collectionView.width - (self.columnCount - 1) * self.columnSpace) / self.columnCount;
}
if (position > 0 && position >= self.itemCount && self.onLoadMoreFuncId) {
if (position >= self.itemCount && self.onLoadMoreFuncId) {
[self callLoadMore];
}
[node.view.doricLayout apply];