I am using CHTCollectionViewWaterfallLayout for the layout for my UICollectionView and I am trying to make it possible to remove a cell. All the data provided to my cells are loaded from a local database. To delete the cell I am removing it from the database. Next I use the reloadData
function from the collectionView to reload all the cells. This seems to be working fine except for a small bug. The bug is shown in these pictures(I deleted LifeStyleCard2):
Before deletion
After deletion
When I remove the dropshadows the problem gets a little bit less extreme:
However, the problem is still noticable. When I navigate away from the page and navigate back the problem is gone and everything seems to be fine. These are my settings for the layout:
CHTCollectionViewWaterfallLayout *layout =
(CHTCollectionViewWaterfallLayout *)self.collectionView.collectionViewLayout;
layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
layout.headerHeight = 15;
layout.footerHeight = 10;
layout.minimumColumnSpacing = 20;
layout.minimumInteritemSpacing = 30;
self.collectionView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
NSString *deviceType = [UIDevice currentDevice].model;
if([deviceType rangeOfString:@"iPad"].location != NSNotFound){
layout.columnCount = 2;
}else{
layout.columnCount = 1;
}
[self.collectionView setCollectionViewLayout:layout];
I am fully aware there is a method to remove a cell from the collectionview, but this messes with it even more because it resizes all the cells to the default size. I have been struggling with this problem for hours now, I really hope someone can help me.
Thanks in advance!