Reputation: 2444
I have a trigger to catch the button click on my controller like this
[saveButton addTarget:self action:@selector(save:) forControlEvents:UIControlEventTouchUpInside];
and the relevant function is
- (void)save:(id)sender {
//implementation code
}
How do call this function in another function, I try to call this function like as follow but it showing error.
(void)checkStatus{
if(somecondition){
[self save];
}
}
Note that I am new to iOS and Objective-C and I am editing a code of another developer. Please give me a solution.
Upvotes: 0
Views: 2126
Reputation: 82766
your button action has a parameter , so you need to append in the parameter as nil
or self
.do like
- (void)checkStatus{
if(somecondition){
[self save:nil];
}
}
Upvotes: 2