4thSpace 4thSpace - 7 months ago 21
Swift Question

Why isn't cellForRowAtIndexPath fired but other methods are?

numberOfSectionsInTableView
and
numberOfRowsInSection
are both called on my table. The array I'm using has 3 items in it.

cellForRowAtIndexPath
is never called. What would cause this behavior?

Answer

Might be something to do with the dimensions of your tableView. See this other answer for details. Basically, what is says is that if your tableView is too small, then the cellForRowAtIndexPath method is never called. Try making your tableView smaller, or decreasing the size of your header or footer of the tableView. If this doesn't work, try reloading the table using tableView.reloadData() on the main thread.