Hopefully a simple question for a relatively new UIKit
control
I have a UICollectionView
that has a viewLayout
with a single row o
I'm working on a similar problem.
Currently, my UICollectionViewController has two instance variables of UICollectionViewFlowLayout, each with the appropriate insets for portait or landscape.
On rotation, I do this:
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration{
if (UIDeviceOrientationIsPortrait(toInterfaceOrientation)) {
[_itemCollection setCollectionViewLayout:_portraitLayout];
[_itemCollection reloadData];
} else {
[_itemCollection setCollectionViewLayout:_landscapeLayout];
[_itemCollection reloadData];
}
}
The only problem that I'm having is that it randomly crashes with exc_bad_access on setCollectionViewLayout randomly.
Something like the above might work for you. I'm not sure if this is the right way to do things. I have only recently started using UICollectionViews.