tableView.cellForRowAtIndexPath(indexPath) return nil
As stated in the documentation, cellForRowAtIndexPath
returns:
An object representing a cell of the table, or nil if the cell is not visible or indexPath is out of range.
Hence, unless your table is fully displayed, there are some off screen rows for which that method returns nil
.
The reason why it returns nil
for non visible cells is because they do not exist - the table reuses the same cells, to minimize memory usage - otherwise tables with a large number of rows would be impossible to manage.