0

UISwitch added to a UITableviewCell with the target event UIControlEventValueChanged, is not triggering the action messages or events very often (ie the selector action method is not getting called).

Vincent Guerci
  • 14,379
  • 4
  • 50
  • 56
  • 1
    More details might help. What are you doing when expecting "more often" events? – Vincent Guerci Apr 17 '14 at 11:36
  • Could you paste some code? – dlp Apr 17 '14 at 12:49
  • When a switch state is "On", view will be added and when the state is "off",view will be removed. Sometimes, the action method for the uiswitch is not called when the switch state is "off" and action method is called multiple times, when the switch state is "on". – user3544968 Apr 18 '14 at 04:12

1 Answers1

0

The only fix for this issue is to not use iOS's UISwitch and instead use KLSwitch (https://github.com/KieranLafferty/KLSwitch). Due to the bug's intermittent and rare occurrence, it is very difficult to reproduce consistently.

Some observations on iOS 7.1 UISwitch:

  1. The issue never occurs if you tap on the switch instead of dragging the thumb left or right.
  2. Even though it is claimed to be fixed, iOS 7.1 UISwitch will keep sending the same EventValueChanged event to the action method if you keep dragging the switch's thumb in the same direction.
  3. The issue occurs when transitioning from off to on and vice versa. Must re-iterate that you must drag the thumb to get this issue.