我要制作垂直收集视图,每行带有一个标签,并且必须是中心线才能滚动并选择这样的中心点,请指导我谢谢 https://imgur.com/a/gVGzFe5
extension ViewController : UICollectionViewDelegate,UICollectionViewDataSource
{
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return tempArray.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "myCell", for: indexPath) as! MyCollectionViewCell
cell.lblNumber.text = "\(indexPath.row)"
return cell