1

enter image description here

I have tried following but not working

 self.hCltVw.constant = (rowHeight * 8.0)
        let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
        layout.scrollDirection = .horizontal
        layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
        layout.itemSize = CGSize(width: size, height:rowHeight)
        layout.minimumInteritemSpacing = 0
        layout.minimumLineSpacing = 0
        collectionView.reloadData()
        collectionView.collectionViewLayout = layout

But still spaing in collectionview row. Dont know why spacing is not working also if i add + 80 in collectionview height spacing is automatically removed.

My Xib Setup

enter image description here

NOTE: the strange thing is if I increase collection-view height constant then space is decreasing.

Jaydeep Vyas
  • 4,411
  • 1
  • 18
  • 44

1 Answers1

0

i had same problem, i solved it by this may be it will helpful for you .

in storybord select your collectionview and change some settings in attribute inspector.

  • set estimate size = none
  • in section insets top,bottom,left,right set this all value 0
  • set min Spacing (for cell , for line both) = 0

[edited]

try this:-

let width = (view.frame.size.width) / 3
        let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
        layout.itemSize = CGSize(width: width, height: width)
Shivam Parmar
  • 1,520
  • 11
  • 27