Krunal Krunal - 4 months ago 10
iOS Question

Unable to adjust cell spacing in UICollectionView

I have implemented collectionView in Swift,

but the spacing between the cell increases when i check it in bigger screen iPhones.

This is the example of iphoen 5s
1:

This is the example of iphone 6
2:

here is my xcode design
3:

Where i am making mistake?
can any one help me here..

Thank you in advance !

Answer

This solved my problem..

func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
    {
        return CGSizeMake((UIScreen.mainScreen().bounds.width-15)/2,208); //use height whatever you wants.
    }
Comments