John S.
John S.

Reputation: 3

Calling Button-Clicked Function From Code

I have a function set up in my code like so:

-(IBAction) buttonClicked: (id) sender{

//various expressions here

}

The question is, how can I call this buttonClicked() function from somewhere else in the code, without requiring a user click the button. For example, how can I call it from viewDidLoad()?

Thank you for any help.

Upvotes: 0

Views: 124

Answers (1)

drfranks3
drfranks3

Reputation: 665

If you're calling in the same file, you can use:

[self buttonClicked:self];

Depending on what your method does.

Upvotes: 2

Related Questions