Omer Waqas Khan
Omer Waqas Khan

Reputation: 2413

Calling function in xcode iPhone

If I have this function for button click

-(IBAction)loginButton:(UIButton *)sender{ }

How can I call this button function from this another method

-(void)increaseAmount {
myNumber = myNumber+0.01;

if (myNumber >= 1) {

    [self loginButton:sender];   

}

progressViewAuto.progress = myNumber;}

I have tried the above code but getting error that USE OF UNDECLARED IDENTIFIER 'sender'

Upvotes: 1

Views: 4821

Answers (3)

Hot Licks
Hot Licks

Reputation: 47759

And, if you want to be perfectly correct, you can link your UIButton to IBOutlet UIButton* theLoginButton; and then say [self loginButton:theLoginButton];.

But this would only be needed if you actually reference the sender in your loginButton routine, and that's the exception rather than the rule.

Upvotes: 1

MarkPowell
MarkPowell

Reputation: 16540

Simply pass in nil or even self.

Upvotes: 2

mattjgalloway
mattjgalloway

Reputation: 34912

You probably just want to send nil, like this:

[self loginButton:nil];

Upvotes: 0

Related Questions