On Nov 17, 2010, at 10:54 AM, Matt Neuburg wrote: > > On Nov 17, 2010, at 10:25 AM, Jonathon Kuo wrote: > >> One question though: Taking another poster's suggestion, I placed a UISwitch >> in the toolbar and set Touch Down on it. It does register, but only for the >> OFF -> ON transition. Switching it from ON -> OFF doesn't invoke the action >> method. Should I be using one of the other events to capture both state >> transitions? > > Yes. Just connect the switch to the controller in the nib to form an action; > the correct event will be selected automatically.
Yep, using "Value Changed" it invokes the action for both switch transitions. I can just look at [sender state] and tell what's going on. Cool. > > Please understand that I am trying to educate, not criticize, when I say that > for success in programming (for iOS or anything else) you must be willing to > try stuff - on your own. This has nothing to do with being a newbie - it's a > matter of character and determination. You could have selected the UIButton > within the UIBarButtonItem; you just didn't try hard enough. If you had, > repeated clicking and playing around would have led you to the truth. > Similarly, to discover what event is appropriate for a UISwitch, try > different events and see. m. Heh, this is kinda what I'm afraid of doing - screwing around with stuff and getting things to work, but not in the Cocoa Way.™ I guess there's a bit of intimidation to it so I try to follow where its leading me and not force it. But I suppose you're right, success awaits those who go where angels fear to tread (or whatever that saying is!) _______________________________________________ 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