Giter Club home page Giter Club logo

Comments (6)

juliusbtesh avatar juliusbtesh commented on September 22, 2024 1

I found a way to get this to work! Took me some time to figure it out, had to keep searching through different comments but if anyone Is interested.

I created a method named 'reload' which is set like this

- (void)reload { [self.collectionView reloadData]; self.itemAttributes = nil; [self prepareLayout]; }

So anytime I need to reload the data, I call this function instead of just the collectionView reloadData.
PS: Keep in mind that the itemSize array might also need to be reset but I am using this collection view across several scripts and I am setting up the itemSize based on the controller using it

from customcollectionviewlayout.

juliusbtesh avatar juliusbtesh commented on September 22, 2024 1

@adamhongmy Very possible. I never really use insert or remove cells... I usually just do reload data but you make a good point

from customcollectionviewlayout.

adamhongmy avatar adamhongmy commented on September 22, 2024

+1

from customcollectionviewlayout.

adamhongmy avatar adamhongmy commented on September 22, 2024

but how about adding more? it seems this class is not design with all these in mind....

from customcollectionviewlayout.

juliusbtesh avatar juliusbtesh commented on September 22, 2024

@adamhongmy Are you talking about adding cells? Well your data would come from an array and you can add/remove from that array during run time and then call the reload function above to reload the collection view with the new dataset

from customcollectionviewlayout.

adamhongmy avatar adamhongmy commented on September 22, 2024

@juliusbtesh that is one way to do it but reload the whole layout will cause lag if there are many data (like 200). Don't you think so?

from customcollectionviewlayout.

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.