Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6032019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:16:19+00:00 2026-05-23T05:16:19+00:00

I had the idea to subclass UIViewController as a base class for my subsequent

  • 0

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 : UIViewController

DashboardViewController : BaseLogoutViewController
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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:16:19+00:00Added an answer on May 23, 2026 at 5:16 am

    things you have implied, but i’d like to confirm:

    • you are going to have more than one view controller pushed/popped onto the navigation controller?
    • you want the logout button on every view that gets pushed onto the navigation controller?

    that said, loadView is not what you want to override, viewDidLoad is where you want to put the above code,

    ‘loadView` is responsible for (oddly enough) loading the view, which it is not doing, by overriding it, you have prevented it from happening, you want to augment the view once it has been loaded,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently had an idea to create my own String class to make using
I had an idea for an app that would periodically access peoples' Facebook data.
I had an idea for a fitness mobile app and I have been developing
I recently had this idea to create a C# Windows Form App that enables
I had an idea for an app that would require me to implement these
I had an idea, if I add a python .py file to my C#
I had the idea of a search engine that would index web items like
I had an idea for a client-side language other than JavaScript, and I'd like
I had an idea I was mulling over with some colleagues. None of us
I had this idea of creating a count down timer, like 01:02, on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.