Swift table row selection wonky

I have a simple table… no scrolling, no sections, am using it as a “menu”
When the user taps on a row, it calls another view based on the row selected.
HOWEVER… it doesnt always return the correct row number

func tableView(_ tableView: UITableView,didSelectRowAt indexPath: IndexPath) {
   print("indexPath = \(indexPath)")

the delegate activates the next view… that isn’t the problem, the problem is indexPath is wrong
but not always :frowning: it works for a while, then returns the LAST row #, then starts working again


I may just replace it with 8 UIButtons instead… using a UITableview would have be more scalable if I decided to add more entries

I went with “button” instead… visually identical to what I had before


very odd… I found a “workaround”
the UITableView was the “exact” size of the devices safearea, each row was 1/8 the safeare height
Scrolling was disabled.

When it was wonky… no matter what row I tapped, it called the LAST ROW, then it called the row I tapped… TWO rows not just the one I tapped… which then of course screwed up the view stack.

I found it I made it a few pixels short, it worked much better.
but decided to change it to 8 UIButtons instead… since it was a small finite number of objects.

Now the Menu works fine, and other things are messed up.

Another view looks like this

Where each of the rounded boxes is a UIButton each with a specific TARGET (they simulate check boxes)
Where [MENU | START] is a SegmentedControl with its own Target (unrelated to the UIBUTTON)

HOWEVER, if I click one of the buttons, it THINKS I clicked the SegCtrl

I even removed all the targets… and clicking one of the boxes still flashes the SegCtrl!


SAME THING is happening on other view with these “CheckBoxes”
and I didn’t change anything

its like the SegCtrl just commanders all clicks all of a sudden

Seems this is on ANY UIButton not just the checkbox class

… so Gremlins is the answer :wink:

I am beginning to this so… Touch ANY UIButton, and the SegmentedControl goes off instead
If I remove the SegCtrl, then the UIButtons work as specified

Strange… if compiled directly to a real device it seems to work just fine… but Simulator routes all touchevents to the Segment Control [sometimes]

you think he needed the Mogway after midnight?

Not sure if this was the reason or not… But I trashed the entire DERIVED DATA folder, and rebooted everything… Today the simulator seems to behave as expected