adit
adit

Reputation: 33674

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

I have this two delegate:

#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 returned 12. but the cellForItem is not called. When I just hardcode the numberOfItemsInSection, it actually is getting called. Any idea of why this weird issue is hapening?

Here's a sample project demonstrating the issue

Upvotes: 0

Views: 2043

Answers (3)

David Pettigrew
David Pettigrew

Reputation: 299

The file PintCollectionViewLayout.m was not included in the Compile Sources in the target's Build phase. Add that, resolved the issue for me.

Upvotes: 0

MKR
MKR

Reputation: 21

If [[AHImageDataSource sharedDataSource] count] is returning nil, cellForItemAtIndexPath will not get called. So please make sure that [[AHImageDataSource sharedDataSource] count] has some value.

I'm not able to download your sample project, so can't help much. :(

Upvotes: 2

Sandeep
Sandeep

Reputation: 221

Did you set the delegate?..

Be sure that the method name is correct or you are missing something..

Upvotes: 0

Related Questions