Giter Site home page Giter Site logo

Comments (5)

jonathantrevor avatar jonathantrevor commented on September 7, 2024

A current workaround is to say you have 1 or 2 more items than you actually have and return fake cells and sizes for them. But that isnt ideal.

from nhbalancedflowlayout.

njdehoog avatar njdehoog commented on September 7, 2024

The behavior of the layout mechanism is that it always tries to fill the available space. The issue with implementing a maximumRowHeight is that it would break the layout mechanism's ability to do that.

Can you explain the kind of behavior that you would expect? Is this only an issue when displaying one or two items?

from nhbalancedflowlayout.

jonathantrevor avatar jonathantrevor commented on September 7, 2024

Im trying to lay out a number of items, between 1 and 100. I'd like them to NOT be constrained by the frame they are in (Im adding them to a parent scroll view) but for each row to roughly be around 100px (for example). So I create the collection view in a really tall frame first, layout the contents, and then resize to fit the height. This strategy works really when I have 3 or more but if I have less than 3 OR all of the images are really tall (say 1000px) then I dont get any reduction in height since the layout manager CAN layout the items and "fit" them in the row. So its not only an issue with fewer than 3 items - but thats the easiest to see it happening on.

So Im currently adding in fake small cells to force the row closer to the minmum height I specify. I guess I could also try and limit the height and do some kind of average guess of the height I'll need for, say 3, items per row.

Thanks for the quick response.

from nhbalancedflowlayout.

njdehoog avatar njdehoog commented on September 7, 2024

Thanks for the explanation. I'm not sure that this component offers the functionality that you're looking for. You might want to try and write your own custom collection view layout. This article offers a good starting point: http://www.objc.io/issue-3/collection-view-layouts.html

from nhbalancedflowlayout.

futuretap avatar futuretap commented on September 7, 2024

I'd like to see a maximum cell size, too. Of course this would mean that the requirement of always filling the row horizontally can't be fulfilled anymore. Nevertheless this would help in the standard case of of a single picture that's zoomed up to 100% row width.

from nhbalancedflowlayout.

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.