0

我有一个调用函数的togglemenu按钮self.navigationController。它工作正常。

[btnMenu addTarget:self.navigationController action:@selector(toggleMenu) forControlEvents:UIControlEventTouchUpInside];

我如何将其称为直接命令?像:

[self.navigationController toggleMenu]; // Not working
4

3 回答 3

2

试试这个,

[self.navigationController performSelector:@selector(toggleMenu)];
于 2013-05-09T05:09:32.503 回答
1

你有两种方法可以做到这一点

1) [self.navigationController performSelector:@selector(toggleMenu)];

2)  get your customenavigtion contoller class instanse and call this method

 NavigationViewController *navigationController = (NavigationViewController *)self.navigationController;
   [navigationController toggleMenu];
于 2013-05-09T05:25:26.737 回答
-2

只是你必须[self toggleMenu];用于方法调用

于 2013-05-09T05:05:19.877 回答