eroth / ERJustifiedFlowLayout

A subclass of UICollectionViewFlowLayout for iOS that supports different types of cell justification and inter-cell spacing.
https://www.cocoacontrols.com/controls/erjustifiedflowlayout
MIT License
70 stars 13 forks source link

Cell at first indexPath not set to correct left sectionInset for larger width cells #2

Closed eroth closed 9 years ago

eroth commented 9 years ago

In the example project (ERViewController) under the following conditions:

self.customJustifiedFlowLayout.horizontalJustification = FlowLayoutHorizontalJustificationLeft;
self.customJustifiedFlowLayout.horizontalCellPadding = 5;
self.customJustifiedFlowLayout.sectionInset = UIEdgeInsetsMake(10, 20, 0, 20);

with xib cell width set to 200, the first UICollectionViewCell in the array of UICollectionViewLayoutAttributes returned in [super layoutAttributesForElementsInRect:rect] does not adhere to the value set on the collection view's sectionInset.left property.

The first cell's origin.x should be 20 but is instead returned higher, causing its origin.x to be set to 0 by the existing logic. This only happens with the first cell returned for each call of this method.

ios simulator screen shot aug 12 2015 11 25 04 pm copy