How to change space between cells in UICollectionV

2020-02-04 07:31发布

I want to reduce the size between cells in row. Now it looks like:

enter image description here

I'm trying this, for reduce the size between them:

let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsets(top: 20, left: 2, bottom: 10, right: 2)
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0

but it doesn't help me. What I do wrong?

8条回答
ゆ 、 Hurt°
2楼-- · 2020-02-04 08:20

Go to the storyboard , right click on collection view and enter image description here

And Check your minimum spacing between the cell and reduce it to zero .

查看更多
SAY GOODBYE
3楼-- · 2020-02-04 08:24

(Swift 4)

  • Click on collection View in storyboard.
  • on right hand side, click size inspector.
  • manage and alter the cell size value and you'll figure it out by yourself.
查看更多
登录 后发表回答