I have a view that has a navigationController with two buttons, START (essentially a login button) and SETTINGS. When I click SETTINGS, the settings view appears and dismisses as planned. I can click on settings and then click back many times without anything crashing. Good.
Now, when a user clicks START, I call the SHOWLOGOFFBUTTONS method to change the buttons that appear at the top of the view, in the navController. The navBar should (and does) now have only a LOGOFF button. When that button is clicked, I call SHOWLOGINBUTTONS so the user has the same login buttons as before, so they can access SETTINGS and START (Login) again.
The problem is, once I do the "button-switch" from LOGIN buttons to LOGOFF buttons back to LOGIN BUTTONS, the SETTINGS button stops working. The SHOWSETTINGS method triggers and runs - no errors occur - but the view does not appear.
Any assistance would be greatly appreciated!!
-(void)showLoginButtons{
self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStylePlain target:self action:@selector(showSettings)];
self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"Start" style:UIBarButtonItemStylePlain target:self action:@selector(tryConnection)];
}
-(void)showLogoffButtons{
self.navigationItem.rightBarButtonItem=nil;
self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"Logoff" style:UIBarButtonItemStylePlain target:self action:@selector(resetConnectionAndScreen)];
}
-(void)showSettings{
SettingsViewController *mySettingsViewController= [[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:nil];
iPhone_PNPAppDelegate *mainDelegate = (iPhone_PNPAppDelegate *)[[UIApplication sharedApplication] delegate];
mySettingsViewController.settings=mainDelegate.settings;
[[self navigationController] pushViewController:mySettingsViewController animated:YES];
[mySettingsViewController release];
}