UICollectionView's cellForItemAtIndexPath is not being called

后端 未结 30 2457
再見小時候
再見小時候 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:52

    Maybe I'm just overlooking it, but it appears your missing your delegate and data source. In your header file, make sure you have added these:

    
    

    and in your viewDidLoad method add this:

    self.myCollectionView.delegate = self;
    self.myCollectionView.dataSource = self;
    

    Also, if you are loading it via an .xib, make sure you are have connected the IBOutlet to the UICollectionView.

提交回复
热议问题