Re: Justification of collection cells in sections
Re: Justification of collection cells in sections
- Subject: Re: Justification of collection cells in sections
- From: Doug Hill <email@hidden>
- Date: Mon, 08 Aug 2016 12:35:56 -0700
Hello Peter,
Thanks for the info. I'm still trying to see if I can do what I want with the stock flow layout.
FWIW, it appears that the behavior of the flow layout class is to center items when there is one section.
This appears to be a summary of the behavior:
Collection has one section:
• Items on each line are centered on the line, including multiple items per line.
Collection has multiple sections:
• If one item in the section, center on the line.
• Multiple items per section, flow from left-to-right, including across lines.
I wish the multiple section case was consistent flowing left-to-right.
Doug
> On Aug 3, 2016, at 1:12 PM, Peter Tomaselli <email@hidden> wrote:
>
> I remain a non-expert on this topic, but my assumption has always been that the current “look” is by design. Ugly, but by design. “Equally distribute cells across the row” could be taken to mean that in the case of one cell, it belongs in the middle… [shrug]
>
> This is some of the first Cocoa code I wrote so please forgive… almost everything about it, but here’s the FlowLayout subclass I mentioned: https://github.com/Peterbing/CV-AutoLayout/blob/master/TemplateProject/TheFlowLayout.m#L31 <https://github.com/Peterbing/CV-AutoLayout/blob/master/TemplateProject/TheFlowLayout.m#L31>
>
> This is a completely “left-justified” layout and it works by overriding the `layoutAttributesFor*` methods to call super, and then squishes everything over to the left before returning the attributes to the caller.
>
> This is certainly not production-quality code but perhaps it’s a start! IIRC there is Apple documentation (or perhaps it was a WWDC session) about creating a simple “tweaked” UICollectionViewFlowLayout subclass — so my impression is that this approach in general is kosher.
>
> On Wed, Aug 3, 2016 at 3:38 PM, Doug Hill <email@hidden <mailto:email@hidden>> wrote:
> So, does anyone know if the current behavior I mentioned is a bug? Is the behavior of Flow Layout documented? Should I file a bug with Apple?
>
> Also, what would be some quick ways to modify the flow layout behavior to handle this case with one item per section?
>
> Doug Hill
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden