Hey!
Im trying to implement a standard hierarchical menu, and I've actually got it working to the point where it compiles and I can pick an entry and the appropriate subview loads. What I can't figure out is how to make it so I can return to the menu from the subviews.
What I've done is this:
Code:
- (IBAction)loadFoo:(id)sender {
if (self.fooViewController == nil) {
FooViewController *aFooViewController = [[FooViewController alloc] initWithNibName:@"FooView" bundle:nil];
self.fooViewController = aFooController;
[aFooController release];
}
BarAppDelegate *appDelegate = (BarAppDelegate *)[[UIApplication sharedApplication] delegate];
BarViewController *viewController = (BarViewController *)[appDelegate viewController];
UIWindow *window = (UIWindow *)[appDelegate window];
[viewController.view removeFromSuperview];
[window addSubview:fooViewController.view];
}
Now I tried to essentially do the reverse of this and pretty soon ended up in cyclical dependencies territory with some really cryptic errors. I also tried flattening out the hierarchy so that the menu was essentially just another choice that happened to be loaded automatically, but then I ended up in the same place as before with the added problem of having to kick every decision up a level. So, am I going about this in a really boneheaded way? It *feels* like something that should be trivial enough to implement...