I\'ve been updating my apps to run on iOS 7 which is going smoothly for the most part. I have noticed in more than one app that the reloadData
method of a
dispatch_async(dispatch_get_main_queue(), ^{
[collectionView reloadData];
[collectionView layoutIfNeeded];
[collectionView reloadData];
});
it worked for me.
Do you set UICollectionView.contentInset? remove the left and right edgeInset, everything is ok after I remove them, the bug still exists in iOS8.3 .
Check that each one of the UICollectionView Delegate methods does what you expect it to do. For example, if
collectionView:layout:sizeForItemAtIndexPath:
doesn't return a valid size, the reload won't work...
I also had this problem. By coincidence I added a button on top of the collectionview in order to force reloading for testing - and all of a sudden the methods started getting called.
Also just adding something as simple as
UIView *aView = [UIView new];
[collectionView addSubView:aView];
would cause the methods to be called
Also I played around with the frame size - and voila the methods were getting called.
There are a lot of bugs with iOS7 UICollectionView.
try this code.
NSArray * visibleIdx = [self.collectionView indexPathsForVisibleItems];
if (visibleIdx.count) {
[self.collectionView reloadItemsAtIndexPaths:visibleIdx];
}
I had exactly the same issue, however I managed to find what was going on wrong. In my case I was calling reloadData from the collectionView:cellForItemAtIndexPath: which looks not to be correct.
Dispatching call of reloadData to the main queue fixed the problem once and forever.
dispatch_async(dispatch_get_main_queue(), ^{
[self.collectionView reloadData];
});