So I decided to roll my own.
I have never used a UINavigationController control before, but it makes sense to use one for this area of my app as the settings involve navigating through various nested views - exactly what UINavigationController is designed for.
I pull out my iPhone book and read up on UINavigationController and run through a few tutorials on the net, it all seems easy enough!
Then I try to integrate this into my app.
And the problems begin.. All the tutorials assume the Navigation Controller will be managing all your views and are created in the Root View controller xib. I don't want this, I want it to be created by my settings view.
After several hours of messing about, I got bored and decided to just create one in code. Amazingly this was so easy!
Create the View Controller that you want to set off. Create a navigation controller with your View Controller, set a few options and then call presentModalViewController.
MainSettingsController *controller = [[MainSettingsController alloc] initWithNibName:@"MainSettingsController" bundle:nil];
controller.options = self.options;
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController: controller];
nav.navigationItem.prompt = @"Settings";
controller.title = @"settings";
nav.toolbarHidden = false;
[self presentModalViewController:nav animated:YES];
You're done. No faff at all!
To get rid of the navigation controller again, call
ReplyDelete[self dismissModalViewControllerAnimated:YES];