我試圖用自動佈局將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