NSCollectionViewFlowLayout produces a layout with items justified on the right margin or, if the container is only wide enough for one item, centres items. I was expecting an alignment option, e.g. on the delegate, but am not finding anything in the docs. Does it require subclassing NSCollectionViewFlowLayout to achieve this?
相关问题
- How do I layout forms in MaterialUI?
- GridLayoutManager spacing is not consistent
- Android: Layout object with integer in ID cannot b
- What is the difference between LinearLayout and Fi
- qt: after moving window off-screen, how to move it
相关文章
- Centering a WPF control
- make scroll bar take no space
- In Qt, how do I align form elements in different g
- TableView has more columns than specified
- How to put text in the upper right, or lower right
- How to set time to Android AnalogClock in app widg
- How to position the view with margin that will loo
- Admob showing over a listview in tab layout
In case your items have the same width...
In the other delegate method, you should change the frame of the NSCollectionViewLayoutAttributes
Here is a subclass that produces a left justified flow layout:
@Obliquely's answer fails when the
collectionViewItems
are not uniform in height. Here is their code modified to handle non-uniformly-sized items in Swift 4.2:A shorter solution for swift 4.2: