Instance Method


Initializes and returns a newly allocated collection view object with the specified frame and layout.


- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout;



The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This frame is passed to the superclass during initialization.


The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil.

Return Value

An initialized collection view object or nil if the object could not be created.


Use this method when initializing a collection view object programmatically.

This method is the designated initializer.

See Also

Initializing a Collection View