I've got a TabBarController
which has two tabs. In each tab I've got UICollectionView
and UITapGestureRecognizer
which fires every time when I tap on collectionView
. Everything works fine after the app is started. But if I rotate to landscape orientation, TapGestureRecognizer
fires only in the collectionView
's old frame. It absolutely ignores the right side of the screen.
But if I switch to another tab and then back, it'll work fine for landscape orientation too. I just don't understand what I'm doing wrong.
That's how I change orientation mode for collectionView
:
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
[self.cardCollectionView.collectionViewLayout invalidateLayout];
}