- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
...
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.minimumInteritemSpacing = 0.f;
layout.minimumLineSpacing = 0.f;
layout.sectionInset = UIEdgeInsetsZero;
[self.collectionView setCollectionViewLayout:layout animated:YES];
[_collectionView scrollToItemAtIndexPath:currentIndexPath atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:NO];
}
2. UICollectionView delegate 에서 함수 사이즈 return
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) {
return CGSizeMake(320.f, 180.f);
}
return CGSizeMake(568.f, 320.f);
}
댓글 없음:
댓글 쓰기