2015-08-18 16:07:51.523 Example[16070:269647] the behavior of the UICollectionViewFlowLayout is not defined because: 2015-08-18 16:07:51.523
Example
I've been struggling with this problem for some hours, too.
My UICollectionViewController
is embedded in a container view, when rotating the iPad from landscape to portrait it showed the error. The cells did resize though.
I solved the error by calling the following in the UICollectionViewController
:
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
self.collectionView.collectionViewLayout.invalidateLayout()
super.viewWillTransition(to: size, with: coordinator)
}
The "super" has to be called after invalidating the layout.
Additionally I needed to call the following in the view where the container view is embedded in:
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
DispatchQueue.main.async {
self.collectionViewController.collectionView.reloadData()
}
}
This way, the cells are updated after the screen rotation is done.