last day (14 days later) » 

9:35 AM
0
A: Collection view cellForItemAt indexPath not getting called (Swift)

Mandeep SinghHere is my code. /* private let reuseIdentifier = "Cell" class CollectionViewController: UICollectionViewController { let myArray = ["John","Rock","Chris","Wwe"] // MARK: UICollectionViewDataSource override func numberOfSections(in collectionView: UICollectionView) -> Int { // #warni...

 
When we create the class for UICollectionViewController, Xcode will automatically create this. You can create a class and check it.
 
Actually, from the tutorial it clearly told me to remove this, and before I removed it it didn't work as well
 
@BrightFuture, Please change the background colour of collection view and cell. And see whether your collection view and cell are created or not. I am also facing the same issue right now.
 
@MandeepSingh interesting method. The collection view is created, but the cell is probably not, as I can't see it.
I think @dylanthelion has a point, I am having some layout issues I guess, as Xcode gives me a misplaced view warning, and I could never fix it by clicking fix misplacement
 
@BrightFuture, My issue has been solved and my cells are shown properly with data. I can send you the demo if you want.
 
9:35 AM
Can you put your code on the answer so future viewers can see?
 
@BrightFuture, Okay
@BrightFuture, now you can see my all code.
Hi Bright
 
thanks for posting it, I think the biggest difference between our code is the data source of my cell gets set after viewDidAppear
Yours gets set right from the beginning
 
I have just made this demo for you.
 
If you assign myArray's value in viewDidAppear method, I guess it won't work
 
M happy, if your issue has been solved.
 
9:38 AM
Thanks!
 
Okay, i will try and let you know.
Give me few minutes.
Hey Bright, are you there
 

last day (14 days later) »