JNWCollectionView icon indicating copy to clipboard operation
JNWCollectionView copied to clipboard

should `recalculateAndPrepareLayout` take section insets into account when determining section frame?

Open spilliams opened this issue 10 years ago • 1 comments

I see that a JNWCollectionViewData ("Data") object assigns its sections' frames in -recalculateAndPrepareLayout: (line 89). It appears to do this entirely based on the sections' items (as given by the data source's -collectionView:numberOfItemsInSection:.

I also see that Data adds space for supplementary items (header and footer views).

Shouldn't Data also take into account each section's insets?

I noticed this when debugging my purely-horizontal layout. The scroll view would not let me scroll to see all of my content. In my case, I'm using left and right insets of 130, (and top and bottom of 0). In the short-term I think I can workaround this by overriding my layout's -rectForSectionAtIndex:, but I wondered if this was a bug in the overarching framework.

Thanks! Spencer

spilliams avatar Jan 29 '15 02:01 spilliams

So theoretically custom layouts should override rectForSectionAtIndex: and return the rect of the section, including insets. That should behave correctly.

But in the case where the layout does not implement that, there does appear to be a bug with section insets. Good catch.

jwilling avatar Feb 16 '15 09:02 jwilling