2
0

Fixes for better landscape sizing of avatar cells.

This commit is contained in:
Maarten Billemont 2014-09-12 17:13:33 -04:00
parent 61bed8b29c
commit 9109a59410
2 changed files with 25 additions and 9 deletions

View File

@ -106,7 +106,7 @@ referenceSizeForHeaderInSection:(NSInteger)section {
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)collectionViewLayout;
CGFloat itemWidth = UIEdgeInsetsInsetRect( self.passwordCollectionView.bounds, layout.sectionInset ).size.width;
CGFloat itemWidth = UIEdgeInsetsInsetRect( collectionView.bounds, layout.sectionInset ).size.width;
return CGSizeMake( itemWidth, 100 );
}

View File

@ -108,9 +108,15 @@ typedef NS_ENUM( NSUInteger, MPActiveUserState ) {
[self firedMarqueeTimer:nil];
}
- (void)viewDidLayoutSubviews {
- (void)viewWillLayoutSubviews {
[super viewDidLayoutSubviews];
[self.avatarCollectionView.collectionViewLayout invalidateLayout];
[super viewWillLayoutSubviews];
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
[self.avatarCollectionView.collectionViewLayout invalidateLayout];
}
@ -262,15 +268,25 @@ typedef NS_ENUM( NSUInteger, MPActiveUserState ) {
#pragma mark - UICollectionViewDelegateFlowLayout
- (CGSize) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout
referenceSizeForHeaderInSection:(NSInteger)section {
CGSize parentSize = self.avatarCollectionView.bounds.size;
return CGSizeMake( parentSize.width / 4, parentSize.height );
}
- (CGSize) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout
referenceSizeForFooterInSection:(NSInteger)section {
CGSize parentSize = self.avatarCollectionView.bounds.size;
return CGSizeMake( parentSize.width / 4, parentSize.height );
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
if (collectionView == self.avatarCollectionView) {
CGSize parentSize = self.avatarCollectionView.bounds.size;
return CGSizeMake( parentSize.width / 2, parentSize.height );
}
Throw( @"unexpected collection view: %@", collectionView );
CGSize parentSize = self.avatarCollectionView.bounds.size;
return CGSizeMake( parentSize.width / 2, parentSize.height );
}
#pragma mark - UICollectionViewDataSource