iOS Development Discussion on developing apps for the iOS platform.

Touch Up Inside fine, Touch Down Not


Post Reply New Thread Subscribe

 
Thread Tools
haarlequin

 
Member Since: Apr 15, 2012
Posts: 5
haarlequin is on a distinguished road

haarlequin is offline
When I change the Sent Event of a button in interface builder from Touch Up Inside to Touch Down, I fail to trigger the IBAction.

Any idea why? Am I missing something obvious?

Cheers.
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 143
Mark FX has a spectacular aura about

Mark FX is offline
You have to drag from the UIButtons connections inspector to the app delegate, or view
controller class, and select the desired IBAction method.

By default all UIButton action events are set to touch up inside, and connected to the app
delegate with that connection, but you can also have any number of the other action
methods also connected to the same method.

Try and right click the button, then drag from the round connection marker, next to the touch
down action, and drag to the class object cube where the IBAction method is implemented,
and then select the method from the list.

Regards Mark

Last edited by Mark FX; 04-25-2012 at 02:10 PM.
QUOTE Thanks
haarlequin

 
Member Since: Apr 15, 2012
Posts: 5
haarlequin is on a distinguished road

haarlequin is offline
Thanks Mark,

what's the difference between selecting the IBAction in the first responder and selecting it in the View Controller?

And if you want a laugh: I was changing the iphone Storyboard and testing it in the iPad simulator.

Bugger.
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 143
Mark FX has a spectacular aura about

Mark FX is offline
The First Responder cube object in the Interface Builder is an abstract class, that really
represents nil, in the standard Xcode templates the first responder is linked to the main window, and is the first place all user nil target action events are sent, then the window
forwards thes action events up the responder chain,

The main menu for the application in the standard template also has its methods connected
to the first resopnder, most controls views windows and the application itself are all in the
responder chain, if you want a particular control or project class to be the first responder,
then override the method below.

Code:
- (BOOL)canBecomeFirstResponder
{
        return YES;
}
For example

Code:
[[self view] becomeFirstResponder];
If you want you control or class to resign being the first responder, then send it the message
below.

Code:
[[self view] resignFirstResponder];
If your starting out as a beginner, then I would leave the standard project template first
responder set up as is, that way you can be sure that what ever view is currently on the
main window, it will recieve the user action events.

Regards Mark
QUOTE Thanks

Post Reply New Thread Subscribe


« Newbie Programmer - Looking for advice. | Thrown into this with a current app. that "boss" hates! »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
iPod Touch Gen 3 APPLICATION issues... Lany Apple Notebooks 4 01-28-2011 02:09 AM
Office:mac 2004, a fine Product Of Software mathogre OS X - Apps and Games 12 03-02-2007 10:30 AM

All times are GMT -4. The time now is 08:24 PM.

Powered by vBulletin
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?