I have created an Photo album using UICollectionView.
I want to handle cell size by codding.
If it is possible then please provide me the code.
Thank you.
How to set collection view cell size in iOS?
Ask by Anonymous User
Updated 29 Dec 2015
To set the collection view cell size, you can use collectionView method sizeForItemAtIndexPath: .
Here is an example:
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)layout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {CGFloat width = (CGRectGetWidth(self.view.frame)/3.0f)-15);
return CGSizeMake(width, (width *1.1f));
// total 4 views displayed at a time;
}
I hope the above code is helpful for you, because I am using that code in our own sample.