Forum Archive

Switch in ui module unresponsive

disorientedp

Pythonista 2.0

I am new to the ui module. I've been messing around with it and I've figured out basically how to create user interfaces, but I can't, for some reason, figure out how to use switches. I have a switch in a ui view with an associated function. The problem is that when I tap the switch, nothing happens. The switch doesn't change positions. Why is this happening?

ccc

Does this switch work? import ui ; ui.Switch().present('sheet')

disorientedp

@ccc said:

import ui ; ui.Switch().present('sheet')

Yes.

disorientedp

That's weird. I re-added it and deleted it several times, and it worked on the fourth attempt. I don't know what I did.

Phuket2

@disorientedp , the only thing I can think of , is if somehow the switch was obscured by another view, hence not receiving the touch event. Or you added it to another control as a sub view such as a label. Label, by default does not handle touch events, but you can change that in code