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

  • SEARCH
  • Home
  • 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 6869047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:30:35+00:00 2026-05-27T03:30:35+00:00

I have a toolbar on top of my view with a back button. I

  • 0

I have a toolbar on top of my view with a back button. I would like when the view loads to appear with the toolbar hidden and then, with a touch of the button to appear animated.

–Edit–
I am not using a Navigation Controller.

  • 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-27T03:30:35+00:00Added an answer on May 27, 2026 at 3:30 am

    Given new information – that there’s no UINavigationController – things are different. Here are the relevant bits from my code…

    Create the nav bar and add it to your view:

    // Create the navigation bar
    
    self.navBar = [[UINavigationBar alloc] init];
    [self.view addSubview:self.navBar];
    

    Lay it out..

    - (CGRect)frameForOrientation:(UIInterfaceOrientation)theOrientation
    {
        UIScreen *screen = [UIScreen mainScreen];
        CGRect fullScreenRect = screen.bounds;      // always implicitly in Portrait orientation.
        CGRect appFrame = screen.applicationFrame;
    
        // Find status bar height by checking which dimension of the applicationFrame is narrower than screen bounds.
        // Little bit ugly looking, but it'll still work even if they change the status bar height in future.
        float statusBarHeight = MAX((fullScreenRect.size.width - appFrame.size.width), (fullScreenRect.size.height - appFrame.size.height));
    
        // Initially assume portrait orientation.
        float width = fullScreenRect.size.width;
        float height = fullScreenRect.size.height;
    
        // Correct for orientation.
        if (UIInterfaceOrientationIsLandscape(theOrientation)) {
            width = fullScreenRect.size.height;
            height = fullScreenRect.size.width;
        }
    
        // Account for status bar, which always subtracts from the height (since it's always at the top of the screen).
        height -= statusBarHeight;
    
        return CGRectMake(0, statusBarHeight, width, height);
    }
    
    - (CGSize)viewSizeForOrientation:(UIInterfaceOrientation)theOrientation
    {
        CGRect frame = [self frameForOrientation:theOrientation];
        return CGSizeMake(frame.size.width, frame.size.height);
    }
    
    - (void)layoutSubviewsForInterfaceOrientation:(UIInterfaceOrientation)theOrientation withAnimation:(BOOL)animate
    {
        CGSize fullSize = [self viewSizeForOrientation:theOrientation];
        float width = fullSize.width;
        float height = fullSize.height;
    
        CGRect newFrame = CGRectMake(0, 0, width, height);
        SubViewController *controller;
        UIView *theView;
    
        // Place the navigation bar
    
        CGRect navBarFrame = newFrame;
        navBarFrame.size.height = NAVBARHEIGHT;
        self.navBar.frame = navBarFrame;
    }
    

    Create a function to who it/hide it:

    - (void)showNavigationBar:(BOOL)show
    {
        if (show == YES && self.navBar.hidden == YES) {
    
            // Move the frame out of sight
            CGRect frame = self.navBar.frame;
            frame.origin.y = -frame.size.height;
            self.navBar.frame = frame;
    
            // Display it nicely
            self.navBar.hidden = NO;
            frame.origin.y = 0.0;
            [self.view bringSubviewToFront:self.navBar];
    
            [UIView animateWithDuration:0.3
                             animations:^(void) {
                                 self.navBar.frame = frame;
                             }
             ];
        }
        else if (show == NO && self.navBar.hidden == NO) {
    
            CGRect frame = self.navBar.frame;
    
            // Display it nicely
            frame.origin.y = -frame.size.height;
            [self.view bringSubviewToFront:self.navBar];
    
            [UIView animateWithDuration:0.3
                             animations:^(void) {
                                 self.navBar.frame = frame;
                             }
                             completion:^(BOOL finished) {
                                 self.navBar.hidden = YES;
                             }
             ];
        }
    }
    

    where

    #define NAVBARHEIGHT 44
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have a global toolbar at the top in each view
I would like to have a small view about the size of a toolbar
I have a toolbar and i would like to place it on top of
I have an existing toolbar in my View... when I drag a Bar Button
I'm creating a Sencha Touch application. I would like to have a banner docked
I have a view that contains 3 different views (Top Toolbar, Content Panel, Bottom
I have a view, that when loaded contains a toolbar at the top, and
I have toolbar at the top of the (full screen) main view in my
I have a form with a Toolstrip along the top. On this toolbar I
I'm developing a Firefox extension, and I have a toolbar button that displays an

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.