4

My project has a UICollectionView with a custom cell that used to work perfectly on iPhone and iPad before iOS8. Now in iPad on first load cells look perfect but on rotation

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath

does not get called.

Problem is this is where my rotation logic goes and that's why my UICollectionView twitches.

Michal Shatz
  • 1,398
  • 2
  • 17
  • 31

1 Answers1

1

Here is what solved it: I added the bottom line to my didRotateFromInterfaceOrientation: method

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
[self.collectionView performBatchUpdates:nil completion:nil];

}

Michal Shatz
  • 1,398
  • 2
  • 17
  • 31
  • 1
    I'm seeing the same thing. The problem is that didRotateFromInterfaceOrientation happens after the rotation animations take place, and the result is pretty ugly. I tried this hack in viewWillLayoutSubviews, but it didn't work. Anyone found a solution during rotation? – cetcet Sep 23 '14 at 23:05