【发布时间】:2014-07-24 12:40:07
【问题描述】:
我有一个名为“ImageViewController.xib”的 XIB,其中包含一个集合视图。我已经在 xib 内的这个集合视图上设置了我想要的集合视图布局。
尝试运行我的应用时,我收到错误消息:
'UICollectionView must be initialized with a non-nil layout parameter'
我在 ImageViewController 中使用它:
-(id) initWithImages:(NSArray *)imagesUrls
{
if (self = [super initWithCollectionViewLayout:self.collectionViewLayout]) {
self.imageUrls = [[NSArray alloc] initWithArray:imagesUrls];
}
[self.collectionView registerNib:[UINib nibWithNibName:@"ImageCell" bundle:nil] forCellWithReuseIdentifier:@"Cell"];
return self;
}
我只想使用我在 XIB 中设置的布局,而不是以编程方式制作。
【问题讨论】:
标签: ios objective-c xcode uicollectionview uicollectionviewlayout