views:

148

answers:

1

Hi,

I'm trying to program an iphone app that will have several different (sub)apps. Ideally, I want to know how to make the main menu for this app look and behave like the iphone's own app menu, but I can't figure it out. If any one knows a package or library that does this, please let me know. Plan B is to mock one using UIButtons, and here is where I'm having problems.

Basically, when I press a button that should push a new view, it calls the push method, but I still see the top view.

in the app delegate, I have something like:

AppViewController *viewController;
App1ViewController *app1ViewController;
UINavigationController *navController;

and in didFinishLaunching method, something like:

viewController = [ [ AppViewController alloc ] initWithAppDelegate: self ];
app1ViewController = [ [App1ViewController alloc ] initWithAppDelegate: self ];
navController = [ [ UINavigationController alloc ] initWithRootViewController:viewController];
[window addSubview:viewController.view];

and 2 methods

-(void)app1{[ navController pushViewController: app1ViewController animated:YES ];}
-(void)back{[ navController popViewControllerAnimated:YES ];}

then I have 2 viewcontrollers in AppViewController.h

@interface AppViewController : UIViewController {
UINavigationController *navController;
UIButton *appbtn1, *appbtn2, *appbtn3, *appbtn4;
}
-(id)initWithAppDelegate:(id)appDelegate;
@end
@interface App1ViewController : UIViewController {
UITextView *textView;
UINavigationController *navController;
}
-(id)initWithAppDelegate:(id)appDelegate;
@end

and define a loadView for each viewcontroller. However, when I press the app1 button and the app1 method gets called, it says the view hasa been pushed, but my view remains the buttons view, i.e. the root view. If I press the button again, it tells me I can't repush the app1view, the one I can't see. Any ideas? I can post the full code if that helps.

Thank you for your time.

A: 

Nevermind, I'm such a goof!!! The culprit is:

[window addSubview:viewController.view];

I added the view controller to the window's subview. I should've added the navController instead

[window addSubview:navController.view];

Now it can push and pop views on my window, duh! lol

David
But still, if anyone knows how to program a Springboard (iphone menu) for an iphone app, I would much appreciate it.Thanks
David