title: Showing a one-time UIViewController via presentModalViewController upon launch
body: <p>Greetings! I have a working iPhone app (huzzah!) that uses a <code>MainView.xib</code> containing a fully-stocked <strong>UITabBar</strong> with several <strong>UINavigationController</strong> objects and views at-the-ready.</p>
  
  <p>I've now been asked to add a one-time registration view to this mix. This view would appear <em>before</em> the <strong>UITabBar</strong> at app-launch, get some info from the user, register with a server - or check for an existing registration, then squirrel some data away in the keychain. (If the keychain already shows proof of registration, then we skip showing this particular view.)</p>
  
  <p>The registration and keychain part I've got under control (<em>thank you Erica Sadun for the latter!</em>), but showing that initial one-time view is proving to be trickier than I expected.</p>
  
  <p>I suspect I'm too close to the problem to see what's wrong. I really hope it's pilot error and doesn't require anything too Rube Goldberg!</p>
  
  <p>Here's the scenario:</p>
  
  <p>The app starts by loading <strong>MainView.xib</strong>, in which lies the aforementioned <strong>UITabBar</strong> controller, et. al. For the sake of argument, let's say we must show that registration view. Also, we'd like it to have a modal appearance, so it will fly in from the bottom up. Then, when we're done, we can dismiss it, call a delegate (most likely the App Delegate) and tell it to carry on with the original <strong>UITabBar</strong>.</p>
  
  <pre><code>// Normally, the Tab Bar Controller's view is added to the window ... still do this?
  [window addSubview:tabBarController.view];
  
  // We could now set up a VC like so. Mostly harmless. (I know, "mvc" is an unfortunate abbreviation in this case.)
  RegistrationVC *mvc = [[RegistrationVC alloc] initWithNibName:@"RegistrationView" bundle:nil];
  </code></pre>
  
  <p>Note that <code>RegistrationView.xib</code> has a <strong>UIView</strong> inside, but no nav controller. We want to keep it decoupled so that it can be reused, say, as part of a tab bar item's nav controller (to review your registration info, for instance).</p>
  
  <p>Moving on. We create a nav controller with the intent of presenting things modally:</p>
  
  <pre><code>UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:mvc];
  </code></pre>
  
  <p>We then present our modal VC, using the <em>tab bar controller</em> as the basis, and release the alloc'ed bits.</p>
  
  <pre><code>[tabBarController presentModalViewController:nc animated:YES];
  [nc release];
  [mvc release];
  </code></pre>
  
  <p>First observation. Something tells me this is just plain sloppy. You can see the first tab bar item's nav bar and view appear just as the modal view swoops in. Yeccch! Moreover, trying to set the selected VC to nil beforehand has no effect:</p>
  
  <pre><code> tabBarController.selectedViewController = nil;
  </code></pre>
  
  <p>We really don't want/need to use the tab bar until <em>after</em> the modal VC is done (and we have the delegate to help let us know when that happens).</p>
  
  <p>Why am I even bothering with the Tab Bar? Well, it looks like I need <em>something</em> to hang that modal VC's hat on, and I don't know what else there is to use.</p>
  
  <p>Is this the only way? It just seems to tether the Registration VC and the Tab Bar unnecessarily, and it just smells ... wrong.</p>
  
  <p>Clues welcome/appreciated!</p>