Re: [iPhone] Toolbar button and "Touch Down"
Re: [iPhone] Toolbar button and "Touch Down"
- Subject: Re: [iPhone] Toolbar button and "Touch Down"
- From: Matt Neuburg <email@hidden>
- Date: Wed, 17 Nov 2010 10:54:11 -0800
On Nov 17, 2010, at 10:25 AM, Jonathon Kuo wrote:
> On Nov 17, 2010, at 8:47 AM, Matt Neuburg wrote:
>>
>> On Nov 16, 2010, at 9:26 AM, Jonathon Kuo wrote:
>>
>>> I agree: that's how I expected it to work, too, but that's not how it does work (Xcode 3.2.4). If I drag a Round Rect Button onto the Toolbar, it instantly gets promoted to a UIBarButtonItem (really!), and I can't set "Touch Down" on it, nor can I change the class of it in IB. That's why I'm confused...
>>
>> The Round Rect button that is dragged into the toolbar is not "promoted" to anything. It is wrapped in a UIBarButtonItem, exactly as Dave (and I advised). If you don't understand how to select the button itself using the design window, then use List View in the nib's main document window and drill down until you find it. m.
>
> Thank you Matt for the clear explanation (and your patience with a noob)! I got access to the button from the List view and set the Touch Down event on the button. It works!
>
> 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.
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.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
_______________________________________________
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