0

I created a list by using collection view compositional layout and implemented a default style cell ( please see the picture UICollectionViewListCell

There is a space of 20pt on the left side of the text. The space might be different on different screen sizes.

I tried to set its leading inset to 0, but the space won't reflect the value unless the value is bigger than 20

section.contentInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 0)

Is there any way to remove the space? or how can I get the space value?

P.H.
  • 15
  • 5

1 Answers1

-1

UICollectionViewListCell has a property called indentationWidth which is used to configure the indentation width. You might also want to look at indentationLevel property as well.

let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Item> { cell, indexPath, item in
    cell.indentationWidth = 0
}
Pavel Kozlov
  • 993
  • 6
  • 16