iOS Question SelectedRow Property in TableView

aminoacid

Active Member
Licensed User
Longtime User
I need to get the current index (row) of the item selected in a TableView.

The "SelectedRow" property returns the selection as a TableCell and seems to work

Dim tc As TableCell
tc=TableView1.SelectedRow

However I need it as an Integer (o to n). First item selected = 0, next one =1, etc.

I can't seem to find any way to extract the index from the TableCell. Or basically find a way to obtain the selected row as an int.

Thanks for any feedback on how to do this.
 

aminoacid

Active Member
Licensed User
Longtime User
Figured it out:

Sub TableView1_SelectedChanged (SectionIndex As Int, Cell As TableCell)
Log(Cell.Text.ToString)
Dim i As Int = TableView1.GetItems(SectionIndex).IndexOf(Cell)
Log("Cell index: " & i)
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…