IGListCollectionView
Objective-C
@interface IGListCollectionView : UICollectionView
Swift
class ListCollectionView : UICollectionView
This UICollectionView
subclass allows for partial layout invalidation using IGListCollectionViewLayout
,
or custom layout classes that conform to IGListCollectionViewLayoutCompatible.
Note
When updating a collection view (ex: calling-insertSections
), -invalidateLayoutWithContext
gets called on
the layout object. However, the invalidation context doesn’t provide details on which index paths are being modified,
which typically forces a full layout re-calculation. IGListCollectionView
gives IGListCollectionViewLayout
the
missing information to re-calculate only the modified layout attributes.
-
Create a new view with an
IGListcollectionViewLayout
class or subclass.Note
You can initialize a new view with a base layout by simply calling
-[IGListCollectionView initWithFrame:]
.Declaration
Objective-C
- (nonnull instancetype) initWithFrame:(CGRect)frame listCollectionViewLayout: (nonnull UICollectionViewLayout<IGListCollectionViewLayoutCompatible> *) collectionViewLayout;
Swift
init(frame: CGRect, listCollectionViewLayout collectionViewLayout: any UICollectionViewLayout & IGListCollectionViewLayoutCompatible)
Parameters
frame
The frame to initialize with.
collectionViewLayout
The layout to use with the collection view. You can use IGListCollectionViewLayout here, or a custom layout class that conforms to IGListCollectionViewLayoutCompatible.