Is there a way to stop a UISwitch
from toggling state when you tap on the inactive side? I would like a control that forces a deliberate 'swipe' action to prevent the user accidentally clicking it. I've had a look around but haven't found any setting that removes the instant toggle on tap.
views:
51answers:
1
+1
A:
UISwitch is a child of UIResponder. So you can try to use methods like touchesBegan:withEvent:
, touchesMoved:withEvent:
and touchesEnded:withEvent:
to detect user actions.
The idea is to set some flag to 'changes are not allowed' state, when user began touches. Change it, depending on touch coordinates - for example, change state to 'changes are allowed', if user moved touch more than 25 pixels right. And make real changes when touches ended, depending on final flag's state.
kpower
2010-08-09 11:55:00