当前位置: 动力学知识库 > 问答 > 编程问答 >

ios6 - UICollectionView missing cells on iOS 6

问题描述:

I'm using UICollectionView to display images from camera roll. And I've set up a UICollectionView, and subclassed a UICollectionViewCell in which has a UIImageView to hold the image.

And in the IB, I've set the height of the collection view to 88 and width to 320 which is full width of the screen, and the layout to "Flow" type, scrolling horizontally. The other properties like spacing, section insets are all set to 0.

Here's the strange part, the collection view works fine on my 4" iOS 7 device. But on my 3.5" iOS 6 device, it only shows 6 (out of 28) pictures, which means it picks the first one in every 5 images.

Here's my delegation part of the code:

- (NSInteger)collectionView:(UICollectionView *)view

numberOfItemsInSection:(NSInteger)section {

return [_photoAssets count];

}

- (NSInteger)numberOfSectionsInCollectionView

:(UICollectionView *)collectionView {

return 1;

}

And this is really weird, can anybody help me out?

EDIT: BTW, I'm using auto-layout, if that matters.

网友答案:

OK, I solved my question, seems I miss understood the section and numberOfItems in section. By switching the line:

return [_photoAssets count];

And

return 1;

I made it to show all images.

分享给朋友:
您可能感兴趣的文章:
随机阅读: