Giter Site home page Giter Site logo

Comments (11)

bonzoq avatar bonzoq commented on May 11, 2024 2

Hey @otymartin, here's a rather general description of how I handle this:

  1. Create an IGListCollectionView with vertical flow layout.
  2. Create an IGListSectionController backed by a datasource similar to this:
class DataForHorizontalCollectionView: IGListDiffable  {
    var dataForIndividualCells: [String]?
    
    func diffIdentifier() -> NSObjectProtocol {
       // implement this
    }
    
    func isEqual(_ object: IGListDiffable?) -> Bool {
        //implement this based on the data stored in 'dataForIndividualCells'
    }
}
  1. In your vertical collection view display just one section created in point 2. Also, this section controller should always display just one cell.
  2. Inside that cell add a UIViewController based container
    that has another instance IGListCollectionView in it, this collection view ought to have a horizontal flow layout. In the cellForItem(at index: Int) -> UICollectionViewCell method of your section controller created in point 2, pass data to your second collection view.
  3. Also, you might want to store the content offset of your horizontal collection in a dictionary. This is nicely described by Ash Furrow in https://ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell .

Hope this helps.

from iglistkit.

bonzoq avatar bonzoq commented on May 11, 2024 1

Thank you for answering this so quickly @jessesquires πŸ‘ ❀️

from iglistkit.

otymartin avatar otymartin commented on May 11, 2024 1

@bonzoq Thanks for sharing your solution. Im following along and will reach back when I manage to implement something. Might have some follow up Q's though. (Sticky headers)

from iglistkit.

bonzoq avatar bonzoq commented on May 11, 2024 1

@otymartin sure thing, let me know if you've any questions whatsoever.

from iglistkit.

jr9098 avatar jr9098 commented on May 11, 2024 1

@otymartin thanks for your help, I managed to do it with the example (HorizontalSectionController and EmbeddedSectionController in the example project)!

from iglistkit.

jessesquires avatar jessesquires commented on May 11, 2024

Hey @bonzoq ! Definitely ok πŸ˜„ πŸ‘

So far I've been achieving this by putting a collection view in a table view cell.

This is how we currently handle this for our own uses. (Except we put a collection view inside collection view cells β€” since ListKit is only for collection views.)

We want to provide this functionality "out-of-the-box", but currently don't have a solution. We're tracking this at #31. Let's move this conversation there. 😊

Along these lines, let's say in addition to that, that we want the first 'horizontal' section to be fixed, meaning that it won't scroll along with the second section. Should we just use two different collection views for those sections in this case?

This would definitely be out-of-scope for #31, but we could address this once #31 is finished.

from iglistkit.

otymartin avatar otymartin commented on May 11, 2024

@bonzoq Did you figure this out?

from iglistkit.

jr9098 avatar jr9098 commented on May 11, 2024

@bonzoq I tried to implement this solution but my horizontal collection view is not receiving any touch event and i'm not able to scroll it. Did I missed something?

from iglistkit.

otymartin avatar otymartin commented on May 11, 2024

@jr9098 Did you use my method of embedding the collectionview in a tableview cell?

from iglistkit.

jr9098 avatar jr9098 commented on May 11, 2024

@otymartin I'm using @bonzoq 5 steps solution

from iglistkit.

otymartin avatar otymartin commented on May 11, 2024

@jr9098 I documented my solution in #304 incase. I never managed to implement this method but can't believe it would be that hard, the example projects do it.

from iglistkit.

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.