Comments (5)
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.
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.
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.
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.
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)
- Crash HOT 5
- Asynchronously loading preferredSizeForItemAtIndexPath
- Adding new items to the collection rearranges old cells HOT 3
- Images are upscaled during the layout HOT 4
- Change back layout from UICollectionFlowLayout to NHBalancedFlowLayout cause crashes HOT 1
- Add supplementary views HOT 1
- How to use NHBalancedFlowLayout HOT 2
- Layout issue with xcode 6 GM HOT 12
- Images does not fill cell frame HOT 3
- Not working without Xib file HOT 4
- Randomize cell size HOT 1
- Bug on reload
- how i can force it to make 2 2 2
- Load images remotely HOT 1
- Crash
- Performance on large camera roll HOT 2
- i need fix row height with horizontal scroll, but its not working HOT 1
- Huge amount of items
- Wrong collectionViewContentSize HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nhbalancedflowlayout.