我试图用自动布局将UICollectionView
添加到我的应用程序,但它不断崩溃。这是我的代码:iOS CollectionView崩溃
_collection = [[UICollectionView alloc] init];
[_collection registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:kCellId];
_collection.collectionViewLayout = [DXSelectionViewLayout new];
_collection.translatesAutoresizingMaskIntoConstraints = NO;
_collection.dataSource = self;
_collection.hidden = YES;
错误:
2014-05-14 16:16:09.978 Sportlinked[4712:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'UICollectionView must be initialized with a non-nil layout parameter'
为崩溃表明我猜这个问题可能在_collection.collectionViewLayout = [DXSelectionViewLayout new]; – user2071152