For my case, I just needed to know when the value changed. So I
adapted what you came up with to look like this:
[switchView addTarget:self action:@selector(switchTouched:)
forControlEvents:UIControlEventValueChanged];
UIControlEventAllTouchEvents was sending 3 messages to switchTouched:
e
Using isOn gives you whether the switch is on of off. I'm not sure if
this is what you are looking for. In my case I wanted to know whether
the user is manipulating (touching) the switch, regardless of its
state. I found a way to do it. The code is as follows:
Add this upon creation of the
We may be able to combine forces here. What I was doing gets the
correct answer from the switch, but what I was finding is that certain
circumstances do not result in a message being sent from the switch.
I forget just now which circumstance it was, but I believe it was a
direct tap on th
I need to know whether the user is touching inside a UISwitch control.
The UIControlEvent(s) do fire, but then isTouchInside always gives NO.
My code is:
- (void)switchTouched:(UIControl *)sender
{
NSLog( @"switchtouched:%d", [sender isTouchInside]) ;
}
The switchTouched method was