I have an NSButton btnOne and when the user clicks on the button, I want to simulate a click on another button btnTwo. btnTwo has an action which displays a message when clicked.
- (IBAction)btnOneClicked:(id)sender
{
[btnTwo performClick:self];
}
- (IBAction)btnTwoClicked:(id)sender
{
NSLog(@"btnTwo clicked");
}
When I run the program and click on btnOne, the performClick does not seem to simulate the click on btnTwo as no message is displayed.
I've also tried overriding the performClick() of btnTwo in an NSButton subclass to display the message.
-(void)performClick:(id)sender
{
NSLog(@"performClick");
}
This is also not happening. The message is not getting displayed.
What am I doing wrong?
Thanks.
I know it's a late answer, but better late then never, right? :)
add
at the end of your overridden performClick method.
Why it doesn't call the action method in the first place (without overriding performClick) is a thing that can have many problems. Are the buttons connected to their action methods?