views:

32

answers:

1

First off I'm new at programming. I'm creating an app with one navigation bar controller. The app is pretty basic except for a quiz section that is comprised of 12 xibs. As the users takes the quiz a new xib is pushed onto the stack. I want to create a button that takes the user back to the home screen if they do not want to complete the quiz. The back button takes them to the previous xib which could be 11 deep. Is it possible to dismiss the modal views and reload the rootView controller?

Here's the code from my delegate

@synthesize window; @synthesize navigationController;

  • (void)applicationDidFinishLaunching:(UIApplication *)application {

    // Override point for customization after application launch [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; }

  • (void)dealloc { [window release]; [navigationController release]; [super dealloc]; }

This is how I'm pushing new xibs onto the stack

(IBAction) showTesting: (id)sender { Testing *varTesting = [[[Testing alloc] initWithNibName:@"Testing" bundle:nil] autorelease]; [[self navigationController] pushViewController:varTesting animated: YES]; }

Any help would be greatly appreciated. Thanks

+1  A: 

You can just call popToRootViewControllerAnimated: to go back to the first view controller.

zonble
Thank you for such a simple fix. Cheers