iphone menu navigation with buttons help requested

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-05-03T03:58:25Z Indexed on 2010/05/03 4:08 UTC
Read the original article Hit count: 383

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.

© Stack Overflow or respective owner

Related posts about iphone-simulator

Related posts about pushviewcontroller