Create a UICollectionView

suggest change

Initialize a UICollectionView with a CGRect frame:

Swift:

let layout = UICollectionViewFlowLayout()
let collection = UICollectionView(frame: CGRect(x: 0, y: 0, width: 200, height: 21), collectionViewLayout: layout)

UICollectionView must be created with a non-nil layout. init(frame:) alone raises an exception.

Objective-C:

UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
UICollectionView *collection = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, 200, 21) collectionViewLayout:layout];

You can also create a UICollectionView in Interface Builder

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents