lazy var collectionView: UICollectionView = {
let collectionLayout = UICollectionViewFlowLayout()
collectionLayout.itemSize = CGSize(width: 260 / 4, height: 80)~
collectionLayout.scrollDirection = .horizontal
collectionLayout.minimumInteritemSpacing = 0;
collectionLayout.minimumLineSpacing = 0;
collectionLayout.sectionInset = UIEdgeInsets.init(top: 0, left: 10~, bottom: 0, right: 0)
let collection = UICollectionView(frame: .zero, collectionViewLayout: collectionLayout)
collection.delegate = self
collection.dataSource = self
collection.showsVerticalScrollIndicator = false
collection.showsHorizontalScrollIndicator = false
collection.isScrollEnabled = false
collection.register(cellWithClass: ImageLabelCollectionViewCell.self)
collection.backgroundColor = .clear
return collection
}()
extension HomeNotesCell: UICollectionViewDataSource, UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 6
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withClass: StateNumberCollectionViewCell.self, for: indexPath)
return cell
}
}
网友评论