title: switching between viewControllers
body: <p>I've used this method on several apps that are for sale on the app store, but for some reason the current app I am working on is driving me nuts... I must be overlooking something.</p>
  
  <p><strong>The app's main viewController .h file:</strong></p>
  
  <pre><code>#import "MainMenuController.h"
  #import "GamePlay.h"
  
  @interface ProjectNameiPhoneViewController : UIViewController &lt;MenuDelegate, GameDelegate&gt; {
        UIViewController *currentPageController;
  }
  </code></pre>
  
  <p><strong>The app starts up and loads the MainMenu viewController:</strong></p>
  
  <pre><code>UIViewController *nextController = [[MainMenuController alloc] initWithNibName:@"MainMenuController" bundle:nil];
  [nextController performSelector:@selector(setDelegate:) withObject:self];
  
  [self.view addSubview:nextController.view];
  
  currentPageController = nextController;
  [currentPageController retain];
  [nextController release];
  </code></pre>
  
  <p><strong>From MainMenuController.m, the user chooses to start the game:</strong></p>
  
  <pre><code>[delegate startGameplay:self];
  </code></pre>
  
  <p><strong>Back in the app's main viewController:</strong></p>
  
  <pre><code>- (void)startGameplay:(MainMenuController *)sender {
  
      UIViewController *nextController = [[GamePlay alloc] initWithNibName:@"GamePlay" bundle:nil];
  
      [nextController performSelector:@selector(setDelegate:) withObject:self];
  
      [currentPageController.view removeFromSuperview];
      [self.view addSubview:nextController.view];
  
      [currentPageController release];
      currentPageController = nextController;
      [currentPageController retain];
      [nextController release];
  }
  </code></pre>
  
  <p><strong>From the gameplay screen, user hits the back button to return to the main menu:</strong></p>
  
  <pre><code>- (IBAction)backTapped {
      [delegate backToMenu:self];
  }
  </code></pre>
  
  <p><strong>Back in the app's main viewController:</strong></p>
  
  <pre><code>- (void)backToMenu:(GamePlay *)sender {
  
      UIViewController *nextController = [[MainMenuController alloc] initWithNibName:@"MainMenuController" bundle:nil];
  
      [nextController performSelector:@selector(setDelegate:) withObject:self];
  
      [currentPageController.view removeFromSuperview];
          [self.view addSubview:nextController.view];
  
      [currentPageController release];
      currentPageController = nextController;
      [currentPageController retain];
      [nextController release];   
  }
  </code></pre>
  
  <p>I once again choose to start the game from the main menu.</p>
  
  <p>The GamePlay class/Nib loads, and I once again click the back button to return to the main menu.</p>
  
  <p><strong>At this point the app crashes, with no information printed to the console.</strong></p>
  
  <p>Any ideas would be GREATLY appreciated - I've commented out almost everything else in my code to the point where this switching between viewControllers is practically the only code being run and I'm at a loss as to why it is crashing...</p>
  
  <p>Thanks so much in advance for your help! </p>