Skip to content

collectionView 加载下一页会导致整个列表reload #25

@LB54826

Description

@LB54826
  • (void)hd_dataDealFinishCallback:(HDDataChangeType)type {
    [self hd_dataDealFinishCallback:type animated:NO forceReload:NO];
    }

  • (void)hd_dataDealFinishCallback:(HDDataChangeType)type animated:(BOOL)animated forceReload:(BOOL)forceReload {
    if (type == HDDataChangeSetAll) {
    [self hd_reloadDataAndAllLayout];
    } else if (forceReload) {
    [self hd_reloadData];
    } else {
    if (!animated) {
    [self hd_reloadData];
    }
    }

    if (dataDealFinishCallback) {
    dataDealFinishCallback(type);
    }
    }

您好,我看源码,发现我调用[self.collectionView hd_appendDataWithCellModelArr:cellModelArr sectionKey:@"0" animated:NO];后,最终也会导致collectionView执行reloadData方法,这个是不是没有必要整体reloadData。
举个例子,比如列表cell上有图片,然后图片加载完后执行alpha=0到alpha=1的动画,就算是调用的appendData方法,最终也会执行reloadData方法,就会导致每个cell上的图片重新执行一遍alpha=0到alpha=1的动画,也就是图片会闪一下

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions