Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

indexpath.row is starting from 1 instead of 0

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.

like image 313
ravoorinandan Avatar asked Oct 21 '14 12:10

ravoorinandan


People also ask

Does IndexPath row start 0?

row is starting from 1 instead of 0.

What does IndexPath row return?

So to start with the indexPath. row will be 0. Then it will be 1, then 2, then 3 and so on. You do this so that you can get the correct string from the array each time.

What is IndexPath row?

A list of indexes that together represent the path to a specific location in a tree of nested arrays.

How does Swift define IndexPath?

In Swift, an indexPath is a list of indexes that, together, represent the path to a specific location in a tree of nested arrays. It describes an item's position inside a table view or collection view, storing both its section and its position inside that section.


1 Answers

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.

like image 74
zaph Avatar answered Oct 26 '22 14:10

zaph