Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tableView(:cellForRowAtIndexPath:) Not Called

I know this question has been asked a million times, but I came across this problem and couldn't figure it out for the life of me, and all the previous examples only have unique code to their problem.

I have a viewcontroller, inside of which I have a tableview. I created a custom tableviewcell class and my problem: The cellforrowatindexpath, which is set up in the viewcontroller isn't even called. I've included the UITableViewDataSource and UITableViewDelegate protocols, but no results - my tableview shows up without any of the configurations (mainly populating the cells).

like image 715
Jonas Avatar asked Sep 24 '26 06:09

Jonas


1 Answers

It's super simple, I just figured it out:

Go to the storyboard, select the tableview and ctrl-drag to the yellow box at the top of the view controller (This is a reference to the view controller itself). Then make sure to select both the delegate and datasource options (white dot to the left of the options indicates they're selected).

like image 137
Jonas Avatar answered Sep 26 '26 18:09

Jonas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!