I have an iOSTable that I’m using to display settings information. Some rows need to be selectable but other rows just display data. I can’t find a way to make a row non-selectable, so that if the user taps on the row it isn’t highlighted. Does anybody know if there is a way to do this?
You’ll need to implement this:
Not sure if I’ll be able to get to it soon though since I’m busy.
A simple workaround, is to unselect the row as soon as it was selected, but the row will be highlighted for half a second.
[code] declare sub selectRow lib “UIKit” selector “selectRowAtIndexPath:animated:scrollPosition:” (id as Ptr, row as Ptr, animated as boolean, scrollPosition as integer)
selectRow(table.Handle, nil, false, 0)[/code]
Thanks for the workaround @JrmieLeroy , that helps. And @JasonKing if you do happen to find some time…
Reloading the table data works, too.
declare sub setselectionStyle lib UIKitLib selector "setSelectionStyle:" (obj_id as ptr, style as integer) setselectionStyle(cell.Handle, 0) //0 = no selection
The cell will not appear highlighted but you will still get the Table.Action event.
It is up to you to ignore those rows in the Action event.
Indeed that is a better method. Is there a version of that declare to set the selection style for the whole table, instead of for each individual cell?
I don’t think there is.
It works well though! Thanks again @JrmieLeroy !