-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix supplementary view crash when using IGListCollectionViewLayout
Summary: * Issue: Calling `[UICollectionView layoutAttributesForSupplementaryElementOfKind...]` with an indexPath that doesn't have a supplimentary view. * Cause: `IGListCollectionViewLayout` always returns a non-nil `UICollectionViewLayoutAttributes` when calling `layoutAttributesForSupplementaryViewOfKind` which tells the `UICollectionView` that it's fair game to ask the dataSource for a supplementary view at the indexPath. But when it does, the section controller could return nil, which throws an expection. In the Apple docs about `[UICollectionViewDataSource collectionView:viewForSupplementaryElementOfKind:atIndexPath:]` > This method must always return a valid view object. If you do not want a supplementary view in a particular case, your layout object should not create the attributes for that view. https://developer.apple.com/documentation/uikit/uicollectionviewdatasource/1618037-collectionview?language=objc * Fix: Just like `UICollectionViewFlowLayout`, if the supplementary view size is empty, lets return a nil attribute. Reviewed By: Ziewvater Differential Revision: D17326461 fbshipit-source-id: 507e98f43e951216cf2eafe2449f87df25439e11
- Loading branch information
1 parent
2542d9e
commit cddb297
Showing
3 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters