UICollectionView's cellForItemAtIndexPath is not being called

后端 未结 30 2488
再見小時候
再見小時候 2020-12-07 11:11

Only my second time using UICollectionView\'s and perhaps I have bitten off more than I can chew but nevertheless:

I am implementing a UICollectionView (myCollection

30条回答
  •  星月不相逢
    2020-12-07 11:29

    If your class is subclass from UICollectionviewController and you are creating collectionView programmatically then use

    let layout = UICollectionViewFlowLayout()
        layout.scrollDirection = .Vertical
        layout.itemSize = CGSizeMake(50, 50)
    
        collectionView?.setCollectionViewLayout(layout, animated: false)
    

提交回复
热议问题