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 the "button" of the switch. Swiping the switch worked fine, tapping on the text of the switch worked fine, but tapping on the button did not send a message. I finally just punted and asked each switch for their current status in viewWillDisappear, but this means I cannot react to changes while the user is still in the view.

So, if you use your method, but change it to [sender isOn], does that work? I hope so, because that opens up some possibilities for me.

Brian

On Mar 31, 2009, at 9:22 AM, Joan Lluch-Zorrilla wrote:

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 added as a target to touch events upon creation of the switch like this

[switchv addTarget:self action:@selector(switchTouched:) forControlEvents:UIControlEventAllTouchEvents] ;

Whatever the user does on the switch the result is always Zero. What am I missing?

Joan Lluch-Zorrilla



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/brianslick%40mac.com

This email sent to briansl...@mac.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to