title: Monotouch: UINavigationController, override initWithRootViewController
body: <p>How is it possible to override the constructor for UINavigationController for passing in a rootViewController?</p>
  
  <p>I would have a method like the following in Objective-C:</p>
  
  <pre><code>-(id)initWithRootViewController:(UIViewController*)rootViewController
  {
      UIViewController *fakeController = [[[UIViewController alloc] init] autorelease];
      if (self = [super initWithRootViewController:fakeController]) {
  
        self.fakeRootViewController = fakeController;
  
        rootViewController.navigationItem.hidesBackButton = YES;
  
        [self pushViewController:rootViewController animated:NO];
      } 
      return self;
  }
  </code></pre>
  
  <p>Thank you in advance. Regards.</p>
  
  <p>P.S This snippet of code has been taken from <a href="http://starterstep.wordpress.com/2009/03/05/changing-a-uinavigationcontroller%E2%80%99s-root-view-controller/" rel="nofollow">Change the root view controller</a></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Thank you for your replies. I was interested in the previous snippet of code because it's particular interesting.</p>
  
  <p>@Geoff Norton:  Maybe I'll never use your solution but I find it amazing anyway...</p>
  
  <p>My attempt is to create a sort of UINavigationViewController that acts as a template. In particular, the UINavigationController initially has a loginView (it could be a sort of rootviewcontroller). Then when logging in, I could have two type of views: main and secondary views. The former are at the same level of the login view (they could be a sort of rootviewcontrollers). The latter are pushed above the first ones. You can navigate through the normal UInavigationController stack or by means of a toolbar. The toolbar loads only main view.</p>
  
  <p>Is it possible to do this with a UINavigationController?</p>
  
  <p>Thank you again. Regards.</p>