UICollectionView cellForItemAtIndexPath:未在iOS 7中调用

时间:2013-10-07 15:46:24

标签: objective-c ios7 xcode5

因此代码在iOS 6中运行良好。但是当我在iOS 7设备上运行时,collectionView不会填充项目并保持为空。我发现:

(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 

甚至没有被召唤。

以下是我从

创建collectionView的代码
ItemOptionListCollectionViewController *mv1 =[[ItemOptionListCollectionViewController alloc] initWithNibName:@"GridOpcija" bundle:nil];
[mv1.collectionView registerClass:[OptionListCollectionViewCell class] forCellWithReuseIdentifier:@"CellZaOpcije"];
[mv1.collectionView setDelegate:mv1];
mv1.collectionView.dataSource= mv1;
[mv1 insertListAsDataSource:[ol optionListItems]];
CGFloat scrollHeight = 0;
scrollHeight= ([ol.optionListItems count])*40;
mv1.view.frame = CGRectMake(0, height, modal.scrollView.frame.size.width,scrollHeight);
height +=mv1.view.frame.size.height;
[modal.scrollView addSubview:mv1.view];

而ItemOptionListCollectionViewController非常简单,只有collectionView:cellForItemAtIndexPath:

有什么想法吗?

0 个答案:

没有答案