make cell size relative to collection bounds

This commit is contained in:
Ran Greenberg 2016-06-29 18:02:11 +03:00
parent 08cf37e55f
commit b2e4e5cbc9

View File

@ -60,7 +60,7 @@ static NSString * const CellReuseIdentifier = @"Cell";
-(CGSize)cellSize {
if (CGSizeEqualToSize(_cellSize, CGSizeZero)) {
CGFloat minSize = (MIN(SCREEN_WIDTH, SCREEN_HEIGHT) * 1.00)/3;
CGFloat minSize = (MAX(self.bounds.size.width - (2*self.minimumInteritemSpacing.floatValue),0))/3;
_cellSize = CGSizeMake(minSize, minSize);
}
return _cellSize;
@ -107,12 +107,12 @@ static NSString * const CellReuseIdentifier = @"Cell";
return self.minimumLineSpacing ? self.minimumLineSpacing.floatValue : DEFAULT_MINIMUM_INTERITEM_SPACING;
}
// Layout: Set Edges
- (UIEdgeInsets)collectionView:
(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
// return UIEdgeInsetsMake(0,8,0,8); // top, left, bottom, right
return UIEdgeInsetsMake(0,0,0,0); // top, left, bottom, right
}
//// Layout: Set Edges
//- (UIEdgeInsets)collectionView:
//(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
// // return UIEdgeInsetsMake(0,8,0,8); // top, left, bottom, right
// return UIEdgeInsetsMake(0,0,0,0); // top, left, bottom, right
//}
-(void)setAlbumName:(NSString *)albumName {