美文网首页
HDCollectionView 的SectionHeader数

HDCollectionView 的SectionHeader数

作者: sws1314 | 来源:发表于2023-02-13 10:33 被阅读0次

    HDCollectionView 的SectionHeader数据刷新

    [ws.collectionView hd_changeSectionModelWithKey:@"header1" animated:YES changingIn:^(id _Nonnull secModel) {
    secModel.headerObj = @"新值";
    }];
    
    (void)updateSecVUI:(__kindof id)model
    {
    /// 此方法不会被调用, 我是在这里修改数据的
    }
    

    HDCollectionView 作者回复:

    animated 传YES时只会针对当前段中cell的数据做diff,最后只会刷新数据发生变化的 cell 要刷新header, animated 传NO就行了 (同时也不会做diff了)

    所以在需要刷新SectionHeader的时候, 只需要将animated设置为NO即可:

    [ws.collectionView hd_changeSectionModelWithKey:@"header1" animated:NO changingIn:^(id _Nonnull secModel) {
    secModel.headerObj = @"新值";
    }];
    
    (void)updateSecVUI:(__kindof id)model
    {
        /// 此方法被调用, 在这里重新给界面赋值
    }
    

    相关文章

      网友评论

          本文标题:HDCollectionView 的SectionHeader数

          本文链接:https://www.haomeiwen.com/subject/jevjkdtx.html