0

I've been trying to get this bit of code to work for a while and have done bit of research online to see what could be causing the problem and think something could potentially be blocking the action taking place.

I've placed this bit of code in the viewDidLoad and then the viewWillAppear: methods but it doesn't work.

self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Quit" style:UIBarButtonItemStyleBordered target:self action:@selector(goMenu)];

I have also tried adding break points in the goMenu method which doesn't get called.

Any help with this will be much appreciated as I don't know why it wouldn't be getting called.

Dennis
  • 2,119
  • 20
  • 29
SamoanProgrammer
  • 954
  • 4
  • 13
  • 27

1 Answers1

1
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Quit" style:UIBarButtonItemStyleBordered target:self action:@selector(goMenu)];

Please replace backBarButtonItem to leftBarButtonItem.

This piece of code will work...

Vamshi Krishna
  • 979
  • 9
  • 19
Ved Gupta
  • 86
  • 3