Michal Shatz
Michal Shatz

Reputation: 1416

iOS8 Xcode6 UICollectionView sizeForIndexPath: does not get called on rotation

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.

Upvotes: 4

Views: 337

Answers (1)

Michal Shatz
Michal Shatz

Reputation: 1416

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];

}

Upvotes: 1

Related Questions