因此代码在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:
有什么想法吗?