Reputation: 619
I want to display last image show as half view in all layout. How can I do that?
UICollectionViewFlowLayout flowLayout = (UICollectionViewFlowLayout)self.collectionViewFouth.collectionViewLayout;
CGFloat availableWidthForCells = CGRectGetWidth(self.collectionViewFouth.frame) - flowLayout.sectionInset.left - flowLayout.sectionInset.right - flowLayout.minimumInteritemSpacing *2;
cellWidth = availableWidthForCells / 4;
flowLayout.itemSize = CGSizeMake(cellWidth, cellWidth);
- (CGFloat)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
return 15;
}
Upvotes: 1
Views: 76
Reputation: 1568
Implement Collection View Flow Layout Delegate "UICollectionViewDelegateFlowLayout"
func collectionView(collectionView: UICollectionView,layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
let width = collectionView.frame.size.width/3.5
let height = 100
return CGSize(width,100)
}
Upvotes: 1