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 6763287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:27:29+00:00 2026-05-26T14:27:29+00:00

I have a UINavigationController and in one of it’s view controller, I am making

  • 0

I have a UINavigationController and in one of it’s view controller, I am making the toolbar not hidden in viewDidAppear. Works just fine. But, in viewDidDisappear, I am setting it as hidden but it does not get hidden. What am I doing wrong? Here’s the relevant code:

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    [[self navigationController] setToolbarHidden:NO];

    UIBarButtonItem *buttomSubmit = [[UIBarButtonItem alloc] initWithTitle:@"Submit" 
                                                                   style:UIBarButtonItemStyleBordered 
                                                                  target:self 
                                                                  action:@selector(done)];
    UIBarButtonItem *buttonPrint = [[UIBarButtonItem alloc] initWithTitle:@"Print" 
                                                                     style:UIBarButtonItemStyleBordered 
                                                                    target:self 
                                                                    action:@selector(done)];
    UIBarButtonItem *buttonUnits = [[UIBarButtonItem alloc] initWithTitle:@"Units" 
                                                                    style:UIBarButtonItemStyleBordered 
                                                                   target:self 
                                                                   action:@selector(done)];
    UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace 
                                                                               target:nil 
                                                                               action:nil];

    [self setToolbarItems:[NSArray arrayWithObjects:buttonUnits, flexSpace, buttomSubmit, buttonPrint, nil]];

    [buttomSubmit release];
    [buttonPrint release];
    [buttonUnits release];
    [flexSpace release];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    [[self navigationController] setToolbarHidden:YES];
}

Thanks!

  • 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-26T14:27:30+00:00Added an answer on May 26, 2026 at 2:27 pm

    viewDidDisappear is called after the view has gone off screen. If the view has gone off screen because of pressing the back button it will have been popped off the navigation controller stack.

    From the UIViewController class reference notes on the navigationController property:

    Only returns a navigation controller if the view controller is in its
    stack. This property is nil if a navigation controller cannot be
    found.

    This means that [self navigationController] is returning nil and therefore the setToolbarHidden message is sent to nil and has no effect.

    To hide it after the new view loads which is what you seem to want you could do the hiding in the viewDidAppear method of the new view’s controller instead.

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

Sidebar

Related Questions

I currently have a UINavigationController based application that works just fine. I'd like to
I have one detail view controller in splitView - SearchDeatilViewController. But that view controller
I have a UINavigationController with a UIViewController as the RootViewController. The view controller cycles
I have a standard UINavigationController setup. One particular view displays an Edit button on
I have one issue with UInavigationcontroller In my firstview i have button.If i click
I have a UINavigationController. In its toolbar is a segmented control with two buttons.
I have a uinavigationcontroller with 2 views. In the second view I have some
I have a normal UINavigationController with a UIViewController contained in it, when my view
I have a UINavigationController as one of the views inside a tab bar control.
So you have UINavigationController, with a parent table which has one cell --------------- |

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.