Reputation: 2600
I have a button that call function togglemenu
at self.navigationController
. It works properly.
[btnMenu addTarget:self.navigationController action:@selector(toggleMenu) forControlEvents:UIControlEventTouchUpInside];
How Can I call it as a direct command? Like:
[self.navigationController toggleMenu]; // Not working
Upvotes: 0
Views: 71
Reputation: 476
Try this,
[self.navigationController performSelector:@selector(toggleMenu)];
Upvotes: 2
Reputation: 3901
you have two method to do this
1) [self.navigationController performSelector:@selector(toggleMenu)];
2) get your customenavigtion contoller class instanse and call this method
NavigationViewController *navigationController = (NavigationViewController *)self.navigationController;
[navigationController toggleMenu];
Upvotes: 1