I have a split view app. In portrait mode, the menu would disappear after it was clicked. To fix this I have added a new button, which is just supposed to display the menu:
- (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;
}
Which appears every time I load that view up. My problem is that I am getting an error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DetailViewController showMenu:]: unrecognized selector sent to instance 0x9d58810
I am pretty certain that the problem is with this line:
UIBarButtonItem *btnMenu = [[UIBarButtonItem alloc]initWithTitle:@"Forms List" style:UIBarButtonItemStyleBordered target:self action:@selector(showMenu:)];
My questions are:
(1) Is showMenu: the appropriate method?
(2) What is the target supposed to be?
Thanks.
Thanks to all of you I have found multiple problems with my code.
(1) I thought showMenu was a built in function, and do not had it declared anywhere in my program.
(2) I did not know how the target or action worked.
Thanks guys (girls?) !