Updated IGListCollectionViewLayout to rely on layoutAttributesClass

Summary:
…instead of just allocating a vanilla UICollectionViewLayoutAttributes.    I'm happy to add tests here, but don't really have much of an opinion either way on whether this should have an explicit test case or not.

Issue fixed: #1134

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/1135

Differential Revision: D7551624

Pulled By: rnystrom

fbshipit-source-id: 930218c40b0082912454bb98bd02e7daa8257a3e
This commit is contained in:
Cole Potrocky 2018-04-09 07:29:23 -07:00 committed by Facebook Github Bot
parent 5c7a0318b5
commit 9a45e166cb
2 changed files with 3 additions and 1 deletions

View file

@ -18,6 +18,8 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag
- Fixed footer is sticky when `stickyHeader` is `true` [aelam](https://github.com/aelam) [(#1094)](https://github.com/Instagram/IGListKit/pull/1094)
- Updated IGListCollectionViewLayout to rely on layoutAttributesClass instead of vanilla `UICollectionViewLayoutAttributes` [Cole Potrocky](https://github.com/SirensOfTitan) [#1135](https://github.com/instagram/IGListKit/pull/1135)
- `-[IGListSectionController didSelectItemAtIndex:]` is now called when a `scrollViewDelegate` or `collectionViewDelegate` is set. [Ryan Nystrom](https://github.com/rnystrom) [(#1108)](https://github.com/Instagram/IGListKit/pull/1108)
3.2.0

View file

@ -289,7 +289,7 @@ static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attribut
return nil;
}
attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
attributes = [[[self class] layoutAttributesClass] layoutAttributesForCellWithIndexPath:indexPath];
attributes.frame = _sectionData[indexPath.section].itemBounds[indexPath.item];
adjustZIndexForAttributes(attributes);
_attributesCache[indexPath] = attributes;