Git Product home page Git Product logo

Comments (2)

aurelienp avatar aurelienp commented on July 20, 2024

It seems like for optimization purpose, cached behaviors and visibleIndexPaths are not reseted in prepareLayout. So if your datasource change and you call reloadData, there will be a crash: your error will surely happen when you call reloadData and your previous number of items was "bigger" than the new one.

You could add a reset method to your layout class that empties _animator and _visibleIndexPaths arrays. Then you call [yourCollectionViewLayout reset] just before reloadData each time you want to refresh your collection view... I'm pretty sure it will work but if you have to reload the data often then maybe you should reimplement a layout more appropriate to your needs. Check this post to understand how have been thought the optimizations that cause the problem: http://www.objc.io/issue-5/collection-views-and-uidynamics.html

Hope it helps

from thspringycollectionview.

fatuhoku avatar fatuhoku commented on July 20, 2024

I get this error when using UICollectionViewFlowLayout. Any ideas how it could have happened?

from thspringycollectionview.

Related Issues (11)

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.