gpt4 book ai didi

iphone - - (UICollectionViewCell*)collectionView :(UICollectionView*)collectionView cellForItemAtIndexPath not called

转载 作者:行者123 更新时间:2023-11-28 22:46:15 41 4
gpt4 key购买 nike

我有这两个代表:

#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
{
return 1;
}

numberOfItemsInSection 返回 12。但未调用 cellForItem。当我只是对 numberOfItemsInSection 进行硬编码时,它实际上正在被调用。知道为什么会出现这个奇怪的问题吗?

这是一个 sample project证明问题

最佳答案

如果 [[AHImageDataSource sharedDataSource] count] 返回 nil,则不会调用 cellForItemAtIndexPath。所以请确保 [[AHImageDataSource sharedDataSource] count] 有一定的值(value)。

我无法下载您的示例项目,所以帮不上什么忙。 :(

关于iphone - - (UICollectionViewCell*)collectionView :(UICollectionView*)collectionView cellForItemAtIndexPath not called,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13152351/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com