I'm switching between layouts in a uicollectionview using this code
-(void)setHorizontalLayout:(BOOL)layout
{
if (layout == YES)
{
[self.collectionView performBatchUpdates:^{
[self.collectionView setCollectionViewLayout:self.horizontalPagingLayout animated:NO];
[self.collectionView setPagingEnabled:YES];
self.galleryInHorizontalScrollMode = YES;
} completion:^(BOOL finished) {
[self.collectionView reloadData];
}];
}
else {
[self.collectionView performBatchUpdates:^{
[self.collectionView setCollectionViewLayout:self.galleryLayout animated:NO];
self.galleryInHorizontalScrollMode = NO;
[self.collectionView setPagingEnabled:NO];
} completion:^(BOOL finished) {
[self.collectionView reloadData];
}];
}
return;
}
but after I change from one layout to the other I am getting the [0,0] indexpathed cell set as the uicollectionview's background. I suspect something with the layer is messed up. And looking over the call stack all looks fine. I can't see any calls to animations that may be messing with the layer.
Any way to invalidate this? what could cause it?