I have a method addClicked that gets called when a button on the navigation bar is clicked. I want to call this later on in the code without having to click the button. What is the syntax for calling this method?
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self action:@selector(add_Clicked:)];
The function is calls looks like this:
- (void) add_Clicked:(id)sender {
I tried:
[self add_Clicked:];
[add_Clicked:];
[self add_Clicked: self];
The last works but I’m not sure why. Can someone provide a link to the doc the would explain how this works?
You have to pass something for the sender. That’s why the last one works.
Try [self add_Clicked:nil]