Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove navigation bar in ios?

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.

like image 398
Rain Avatar asked Sep 20 '13 11:09

Rain


4 Answers

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]; –
like image 135
Hemant Singh Rathore Avatar answered Sep 30 '22 11:09

Hemant Singh Rathore


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!

like image 33
Yup. Avatar answered Sep 30 '22 13:09

Yup.


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

like image 20
IronManGill Avatar answered Sep 30 '22 13:09

IronManGill


Use this may be help full for you

    -(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBarHidden = YES;
like image 29
Jogendra.Com Avatar answered Sep 30 '22 12:09

Jogendra.Com