答案 0 :(得分:0)
最简单的方法是使用collectionView并将lineSpacing设置为0:
let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
let width = collectionView.bounds.width
let height = collectionView.bounds.height
layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
layout.scrollDirection = .horizontal
layout.itemSize = CGSize(width: width, height: height)
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
collectionView.collectionViewLayout = layout
并使用自动布局拉伸collectionView以适合整个屏幕。