How to remove navigation bar in ios?

15,605

Solution 1

In Case if you are using storyboard Make sure green arrow highlighted fields are unchecked  attribute inspector

Option 2

Put below lines of code in didFinishLaunchingWithOptions

[self.navigationController setNavigationBarHidden:YES]; –

Solution 2

The thing to remember is that views will be drawn in a particular order, and they are uniquely affected by your navigation bar. Based on when you hide your navigation bar your other views may change size or position.

Try putting this in viewDidLoad:

self.navigationController.navigationBarHidden = YES;

And then, in viewWillAppear, add your view placement and configuration code.

This strategy will remove the navigation bar FIRST, then properly place and size your assets accordingly.

Happy coding!

Solution 3

Please use this [self.navigationController setNavigationBarHidden:YES]; or self.navigationController.navigationBarHidden = YES; to hide the navigation bar in the view you want it hidden.

Solution 4

Use this may be help full for you

    -(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBarHidden = YES;
Share:
15,605
Rain
Author by

Rain

Updated on June 04, 2022

Comments

  • Rain
    Rain about 2 years

    enter image description here

    - (void)viewWillAppear:(BOOL)animated
    {
        [self.navigationController setNavigationBarHidden:YES animated:animated];
        [super viewWillAppear:animated];
    
    
    }
    
    - (void)viewWillDisappear:(BOOL)animated
    {
        [self.navigationController setNavigationBarHidden:NO animated:animated];
        [super viewWillDisappear:animated];
    }
    

    It's a screen shot when up corner it's slightly display.

    I used this code for hide the navigation bar in view.but when view will start then it's give me effect like navigation bar are present.

    But, I want to remove this effect or remove the navigation bar only this view.