Switch in ui module unresponsivebrowsing

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?

@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