我有这两个代表:
#pragma mark = UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView*)collectionView numberOfItemsInSection:(NSInteger)section
{
NSLog(@"COUNT IS %d", [[AHImageDataSource sharedDataSource] count]);
return [[AHImageDataSource sharedDataSource] count];
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView*)collectionView
{
trả về 1;
}
numberOfItemsInSection 返回 12。但未调用 cellForItem。当我只是对 numberOfItemsInSection 进行硬编码时,它实际上正在被调用。知道为什么会出现这个奇怪的问题吗?
đây là một sample project证明问题
nếu như [[AHImageDataSource sharedDataSource] count]
trở lại không
,则不会调用 cellForItemAtIndexPath
。所以请确保 [[AHImageDataSource sharedDataSource] count]
有一定的值(value)。
我无法下载您的示例项目,所以帮不上什么忙。 :(
Tôi là một lập trình viên xuất sắc, rất giỏi!