Coder Social home page Coder Social logo

Comments (11)

czl0325 avatar czl0325 commented on August 19, 2024

展开和收起的时候需要reloaddata一下,有时候reloaddata还不能马上执行,设置延时0.01秒执行

from zlcollectionview.

AlmostSir777 avatar AlmostSir777 commented on August 19, 2024

最后这样处理的,感觉有点low,
[self.collectionView reloadData];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW,(int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self scrollViewDidScroll:self.collectionView];
});

from zlcollectionview.

czl0325 avatar czl0325 commented on August 19, 2024

dispatch_after(dispatch_time(DISPATCH_TIME_NOW,(int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.collectionView reloadData];
});

直接这样既可!

from zlcollectionview.

AlmostSir777 avatar AlmostSir777 commented on August 19, 2024

还是会偶发错乱问题,都试过了,代理也就那几个代理,也没写错啊,有点懵

from zlcollectionview.

czl0325 avatar czl0325 commented on August 19, 2024

照理说只要延迟执行一下reloadData就可以了,我以前也是这么做的

from zlcollectionview.

czl0325 avatar czl0325 commented on August 19, 2024

[self.collectionViewLabel performSelector:@selector(reloadData) withObject:nil afterDelay:0.01];

这样试看看

from zlcollectionview.

AlmostSir777 avatar AlmostSir777 commented on August 19, 2024

好的,谢谢了

from zlcollectionview.

czl0325 avatar czl0325 commented on August 19, 2024

如果不行把延迟时间加长,0.1秒

from zlcollectionview.

AlmostSir777 avatar AlmostSir777 commented on August 19, 2024

先reloadData一次,然后延时再reloadData一次,就没出问题了,哈哈

from zlcollectionview.

czl0325 avatar czl0325 commented on August 19, 2024

直接延时reloadData吧,第一次reloadData应该是没用的,我之前试过

from zlcollectionview.

AlmostSir777 avatar AlmostSir777 commented on August 19, 2024

嗯嗯,谢了,博主

from zlcollectionview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.