chiahsien / CHTCollectionViewWaterfallLayout

The waterfall (i.e., Pinterest-like) layout for UICollectionView.
MIT License
4.53k stars 701 forks source link

sizeForItemAtIndexPath problem #103

Open y0unghe opened 9 years ago

y0unghe commented 9 years ago

I implemented the CHTCollectionViewDelegateWaterfallLayout protocol

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    Topic *topic = topics[indexPath.row];
    NSLog(@"%@ height: %@", topic.topicTitle, @(size.height));
    return size;
}

But when I launch the simulator, the topic according to the actual cell's height in collection view is not the size which I implemented in the protocol. The NSLog outputs:

title: teipete/PSTCollectionView height: 89.404
title: Jamztang/CSStickyHeaderFlowLayout height: 106.106

But in the simulator the cell's height for teipete/PSTCollectionView is 106.106, and the height for Jamztang/CSStickyHeaderFlowLayout is 89.404.

It seems both cells exchange its height. How is that possible?

Neogene commented 9 years ago

Seems i'm facing the same issue.

shenyuan000 commented 8 years ago

This problem has been solved yet I have encountered such a problem