I'm having trouble removing the default view in a iPhone app. I started with a view based app and want to have button that simply changes to a settings page. I set up the main view with a button called "settings". I set up the settings view. I was able to hook the settings up to its own controller and then in the controller for the main page add this action. This works, but puts the new view behind the start view, so I can see the settings button on the settings page.
Quote:
|
-(IBAction) startSettings: (id)sender { SettingsViewController *settingsControllerview = [[SettingsViewController alloc] initWithNibName:@"Settings" bundle:nil]; [self.view insertSubview:settingsControllerview.view atIndex:0]; }
|
So I figured I just need to remove the first view. I thought this would work:
Quote:
|
[viewController.view removeFromSuperview];
|
Because that's how the delegate originally added it
Quote:
|
[window addSubview:viewController.view]; [window makeKeyAndVisible];
|
But no such luck. So I'm really confused. Obviously, I've got the wrong name for the existing view, but how do I discover what the correct name is?
Any guidance would be greatly appreciated, I've been tearing my hair out for three hours on this.