chiahsien / CHTCollectionViewWaterfallLayout

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

Strange behaviour #144

Open aleksandrach opened 8 years ago

aleksandrach commented 8 years ago

Hey,

I am using two sections, the top one for presenting user data, and the other one for user posts. It should look like the first screenshot. But sometimes it looks like the second screenshot, the second section cells overlap first section. simulator screen shot aug 17 2016 11 41 39 img_1034

aleksandrach commented 8 years ago

Hey,

any news here?

chiahsien commented 8 years ago

no idea

humza-ios commented 7 years ago

i got same error

aleksandrach commented 7 years ago

This is happening if you have at some moment numberOfItemsInSection = 0. I fixed this by adding "placeholder" cell every time the list is empty, and then numberOfItemsInSection = 1 or if it's not empty, it's list.count. But this is a temporary solution.

chiahsien commented 7 years ago

This is happening if you have at some moment numberOfItemsInSection = 0.

Do you mean that numberOfItemsInSection = 0 during scrolling, or? Can you provide steps to reproduce this issue?

aleksandrach commented 7 years ago

For example, when the screen is opened, the list is empty, the collection view's delegate and data source methods are called, then we get the list from the server and reload the collection. The issue is happening at the moment before the list is fetched from the server, because numberOfItemsInSection = list.count = 0;

chiahsien commented 7 years ago

@aleksandrach Can you provide sample project? I also use this layout to present data fetching from server, but it never happens to me.

aleksandrach commented 7 years ago

Here is sample of the class that is implementing this screen. It has two sections, top one for the profile information and second one, the posts. You can see the screenshot in my first comment.

Sample1.txt