I had the idea to subclass UIViewController as a base class for my subsequent controllers with the purpose of adding a "logout" button to the UINavigationController in my app delegate.
//MyAppDelegate.m
@synthesize navigationController; //UINavigationController
//-didFinishLaunchingWithOptions...
[self.window addSubview:navigationController.view];
...
In my MainWindow.xib I have a NavigationController attached to.. navigationController with DashboardViewController as its root view controller.
//BaseLogoutViewController.m
- (void)loadView {
UIBarButtonItem *addButton = [[UIBarButtonItem alloc]
initWithTitle:NSLocalizedString(@"Logout", @"")
style:UIBarButtonItemStyleBordered
target:self
action:@selector(logoutPressed)];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
[super loadView];
}
// -(void)logoutPressed callback implemented
// viewDidLoad, didRecieveMemoryWarning, dealloc implemented
//DashboardViewController.h
@interface DashboardViewController : BaseLogoutViewController { }
DashboardViewController : UIViewController
DashboardViewController : BaseLogoutViewController
The good news is it does show the logout button, but the dashboard does not show it's own view. BaseLogoutViewController does not have a Nib of its own. My question is, how come when I subclass BaseLogoutViewController it no longer shows my DashboardViewController's view?