Reputation: 707
I'm wondering how to call an IBAction
from another IBAction
.
What I want to do is when I touch a button on previousPage
, the title of the nextPage
button to change.
In other words I have these IBActions
:
- (IBAction)nextPageButtonItemPressed:(UIBarButtonItem *)sender
{
...
}
- (IBAction)previousParageButtonItemPressed:(UIButton *)sender
{
//This is what i want to do
[self nextPageButtonItemPressed:sender.title = @"Next Page"];
}
I have also created an IBOutlet
of previousPage
.
@property (strong, nonatomic) IBOutlet UIToolbar *nextPageOutlet;
But I can't find the way to do this.
P.S. The nextPage
is a button in UIToolbar
.
Upvotes: 0
Views: 267
Reputation: 1414
For this, you need to have your UIButton
as an IBOutlet
property.
So something like:
@property (nonatomic, retain) IBOutlet UIBarButtonItem *previousButton;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *nextButton;
- (IBAction)nextPageButtonItemPressed:(UIBarButtonItem *)sender
{
...
}
- (IBAction)previousPageButtonItemPressed:(UIBarButtonItem *)sender
{
self.nextButton.title = @"Next Page";
}
Upvotes: 1