4
votes

I'm trying to use a custom UiCollectionViewLayout but I have a little problem. In my project I want to load some JSON information and present it in a UICollectionView. I need to load the information from WEB and then (when everything is loaded) I need to reload my Collection View. If I use the UICollectionViewFlowLayout everything works great. However, when I try to use my own layout, the reloadData doesn't work properly and nothing happens.

I'm reloading the data with an async task:

dispatch_async(dispatch_get_main_queue(), ^{ 

            [self.newsCollectionView reloadData];

        });

Thanks

1
Please show more code in cellForItemAtIndexPath and your custom layout! - LE SANG

1 Answers

2
votes

It sounds like you're looking for invalidateLayout, which causes prepareLayout, collectionViewContentSize, layoutAttributesForElementsInRect:etc to be called.