Re: How to know when a UISwitch is being touched
Re: How to know when a UISwitch is being touched
- Subject: Re: How to know when a UISwitch is being touched
- From: Brian Slick <email@hidden>
- Date: Wed, 01 Apr 2009 10:03:46 -0400
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 (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden