Reputation: 349
I have a method called LoginAttempt:
with the following class header:
- (IBAction)LoginAttempt:(UIButton *)sender
and I'm trying to call this method in the same class' textFieldShouldReturn:
method like this:
[self LoginAttempt:(SENDER TYPE HERE)];
The problem is, I can't figure out what to call where I put 'SENDER TYPE HERE', running Xcode 5, iOS 7.1 I believe, and Xcode has a suggestion: (UIButton *)
, like I'm supposed to enter a UIButton as the sender. Sorry if this is really amateur, but I'm really new to Objective-C and C, so I'm not really sure what it wants.
I have tried self.self, changing the cast on sender in LoginAttempt to id
, and just taking away the (UIButton *).
How do I successfully call LoginAttempt:
?
Upvotes: 0
Views: 48
Reputation: 62052
You can always just pass nil
.
[self LoginAttempt:nil];
As the method is an IBAction
, it's designed to be hooked up to a IB element and the sender
argument will be a reference to the UI element that called the method. You can send anything or nothing though. Most likely, your implementation of the method doesn't even use the sender
variable, so sending nil
is more than fine.
And by the way, method names should begin with lowercase letters...
Upvotes: 1