indexpath.row is starting from 1 instead of 0

ravoorinandan picture ravoorinandan · Oct 21, 2014 · Viewed 10.4k times · Source

i am facing a strance issue with a uitableview. sometime when my table's datasource/numberofrowsinsection has 3 values, cellforowatindexpath starts from 0-1 instead of 0-0. can someone help me out finding the possible reasons for this issue to happen. even tried printing the logs but the logs were shown for 0 -1 and 0 -2 but not for 0 -0. That means it is not getting called for the first row i.e 0 -0.

Answer

zaph picture zaph · Oct 21, 2014

tableView:cellForRowAtIndexPath: is called as needed to display a cell, if a cell is not going to be displayed it is not called. If row 0 is not being displayed section-cell 0-0 will not be called.