collectionView:cellForItemAtIndexPath: doesn't get called
I want to add new cells in my collection view, but nothing shows up when I
add data.
I have a custom UICollectionViewLayout class, which has been working just
fine, and I've been keeping dummy data in my datasource to adjust the
layout. Now that I got rid of the dummy data, nothing's showing up.
Since the app didn't break and there weren't any warnings, it was
difficult to track down where the problem was, and here's where I found a
clue:
(UICollectionViewLayout class)
-(NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
{
NSArray *array = [self.collectionView.visibleCells description];
...
}
Here, -visibleCells returns an empty array, even when I add data, call
-reloadData and invalidate the layout. So I placed a breakpoint in
-collectionView:cellForItemAtIndexPath:, and it turns out this method is
not called at all. How did the cells show up before?
Any help would be appreciated.
No comments:
Post a Comment