views:

49

answers:

2

Hi, my first xib contains a ScrollView with a springboard like interface in MainWindow.xib:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {   
     navController = [[UINavigationController alloc] init];

[navController setNavigationBarHidden:YES]; [window addSubview:navController.view]; [window sendSubviewToBack:navController.view]; }

When a button is clicked the FirstViewController appears with a tableview and a navigation controller:

    - (void) buttonPushed:(id)sender {
       FirstViewController *firstViewController = [[FirstViewController alloc] init];
       [navController pushViewController:firstViewController animated:YES];
[firstViewController release];


[window addSubview:navController.view]; }

When I click the back button in Navigation Controller to go back to springboard, I get the springboard xib, but unresponsive to touches with a Navigation Bar on top!

- (void)goHome:(id) sender { 
[self.view removeFromSuperview];

How can I go back to springboard screen (mainwindow.xib) without having the navigation bar stacked on top, and be responsive to touches ?

A: 

Did you try calling [navController setNavigationBarHidden:YES]; in your mainview viewWillAppear callback ?

Charter
Well, in ViewDidApper didn't work, but it worked on - (void)goHome:(id) sender { when I click the button.The point is, the gui is still unresponsive to touches.
Bill
A: 

Why don't you set the springboard view to be the root view controller of your navigation controller and get rid of any UI in the window?

I think that the window shouldn't have any UI elements accept view of view controllers that are added to it (by navigation controller or by tab bar controller).

This way you won't have to reinvent the wheel for the first view to load from the springboard view and the back button will work properly.

You can set the navigationBarHidden property to false in the viewDidLoad method of the root view controller (the view controller of the springboard view).

Michael Kessler
well, I have tried adding a ViewController in MainWindow.xib. Under the ViewController is a View with ScrollView and the springboard Interface. I use [window addSubview:dashboardViewController.view] to add the dashboard to window. The i create the Nav Controller: navController = [[UINavigationController alloc] init], add the FirstView Controller to stack: navController.viewControllers = [[NSArray arrayWithObject:firstViewController] retain]; When I click a Button in the springboard I use: [window addSubview:navController.view]; Is there a better way? Because I am in the same position again.
Bill
The better way is to do as he just explained you that is initialize the UINavigationController with the dashboardViewController as the root view controller. Then you can set the hidden property of the navController to YES when your dashboard Controller appear and vice versa when he disappear.
Charter
@Bill, have you tried my suggestion?
Michael Kessler
sure, worked nicely, thanks!
Bill