How is it possible to override the constructor for UINavigationController for passing in a rootViewController?
I would have a method like the following in Objective-C:
-(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;
}
Thank you in advance. Regards.
P.S This snippet of code has been taken from Change the root view controller
EDIT:
Thank you for your replies. I was interested in the previous snippet of code because it's particular interesting.
@Geoff Norton: Maybe I'll never use your solution but I find it amazing anyway...
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.
Is it possible to do this with a UINavigationController?
Thank you again. Regards.