Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 11-25-2009, 08:50 AM   #1 (permalink)
royen
Registered Member
 
Join Date: Nov 2009
Posts: 47
royen is on a distinguished road
Default Unload subview/revert to previous view

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...
royen is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,371
Threads: 93,996
Posts: 402,447
Top Poster: BrianSlick (7,978)
Welcome to our newest member, niieueii
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:59 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.