I am having an error in my iPad project with auto layout constraints. It's happening with a custom UICollectionViewCell I've created in IB, when I rotate the device to landscape. The thing is that none of the constraints are deletable. I'm still learning auto layout, so I'm sure it could just be a matter of adding some restraints and deleting some of the default ones, but I'm stuck. It's definitely happening with my custom cell - when I remove it and use a plain old UICollectionViewCell I get no error.
I searched around and I tried setting translatesAutoresizingMaskIntoConstraints on my custom cell to NO but then I get the following error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UICollectionView's implementation of -layoutSubviews needs to call super.'
Works fine to set it to NO on the subviews of my custom cell, but when I set it on the cell itself it barfs.
Here is the auto layout constraint error I'm getting - it's the usual one:
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"NSAutoresizingMaskLayoutConstraint:0x76bf950 h=-&- v=-&- CMAGalleryCollectionViewCell:0x7687690.height == UICollectionView:0x9161e00.height - 875","NSAutoresizingMaskLayoutConstraint:0x76693c0 h=--& v=--& V:[UIView:0x7665470(704)]",
"NSLayoutConstraint:0x7665850 UICollectionView:0x9161e00.bottom == UIView:0x7665470.bottom",
"NSLayoutConstraint:0x7665740 V:|-(0)-[UICollectionView:0x9161e00] (Names: '|':UIView:0x7665470 )" )
Will attempt to recover by breaking constraint NSLayoutConstraint:0x7665850 UICollectionView:0x9161e00.bottom == UIView:0x7665470.bottom
Any help or suggestions greatly appreciated.
Thanks!