After (successfully) calling
__weak typeof(self) wself = self;
[self.collectionView performBatchUpdates:^{
[wself.collectionView.collectionViewLayout invalidateLayout];
[wself.collectionView setCollectionViewLayout:self.layoutDeletion animated:YES];
} completion:nil];
I receive the following error message:trying to load collection view layout data when layout is locked
the operation works fine, except that one particular UICollectionViewCell not loading its subviews.
I have never seen this error message before, including google. Any ideas what might cause this?
Open the storyboard in a new editor tab. Select Collection View in storyboard document view, press option key and drag the pointer to ViewController class. You will see a new property added: @IBOutlet weak var collectionView: UICollectionView!
A collection view manages an ordered set of content, such as the grid of photos in the Photos app, and presents it visually. Collection views are a collaboration between many different objects, including: Cells. A cell provides the visual representation for each piece of your content.
The error is being generated by calling setCollectionViewLayout
within performBatchUpdates
. It is unclear if this is expected behavior (a coding error) or a bug in iOS. You can report the issue to Apple, but in the meantime you should refactor to perform the layout change without batch updates. You can always use the completion handler to perform any additional updates to the collection view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With