Using an IBAction method when it is not called from an action?

Posted by cannyboy on Stack Overflow See other posts from Stack Overflow or by cannyboy
Published on 2010-06-12T00:57:15Z Indexed on 2010/06/12 1:02 UTC
Read the original article Hit count: 305

Filed under:
|
|
|

Are there any issues when using IBAction when it is not actually called from a user's action?

If you have an action like

-(IBAction)sayHello:(id)sender;

You can call it from within your class like:

[self sayHello:@"x"]

The @"x" doesn't do anything, it just fills in for the sender.

You can actually create an IBAction method without (id)sender

-(IBAction)sayHello;

and call it from both user's actions and from within the code, but then you won't get any useful sender info from the interface. What's the 'correct' way of filling in for the sender, when calling from the code? And can you create sender info to send when it's called from within the code?

Just trying to figure it out.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c