我有一个拆分视图应用程序。在纵向模式下,菜单在单击后会消失。为了解决这个问题,我添加了一个新按钮,它只是应该显示菜单:
- (void)viewDidLoad {
[super viewDidLoad];
// FORM LIST button was dissapearing, this adds it back everytime
UIBarButtonItem *btnMenu = [[UIBarButtonItem alloc]initWithTitle:@"Forms List" style:UIBarButtonItemStyleBordered target:self action:@selector(showMenu:)];
self.navigationItem.leftBarButtonItem = btnMenu;
}
每次我加载该视图时都会出现。我的问题是我收到一个错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DetailViewController showMenu:]: unrecognized selector sent to instance 0x9d58810
我很确定问题出在这一行:
UIBarButtonItem *btnMenu = [[UIBarButtonItem alloc]initWithTitle:@"Forms List" style:UIBarButtonItemStyleBordered target:self action:@selector(showMenu:)];
我的问题是:(1)showMenu:合适的方法吗?(2) 目标应该是什么?
谢谢。