Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide navigation bar

I have 3 views. (say 1st,2nd,3rd). I have pushed the 2nd view (which has a load view method) on the 1st. In the 2nd view I have created the 3rd using initWithFrame (which is inherited from UIWebView). In 2nd view I wrote self.view=3rd view.

Now I want to hide the 2nd view's navigation bar in the 3rd view (i.e., when the user touch to 3rd view screen i.e. UIWebView). I got the touch recognition using gesture, but I can't hide the navigation bar.

3rd view don't support self.navigationController. And if I create 2nd view's object in 3rd, it does not hide the navigation bar. Can anybody help me?

like image 433
Kuldip Avatar asked Jul 01 '11 07:07

Kuldip


People also ask

How do I hide the navigation bar on my Samsung?

It's a nice mixture of Android 9 Pie and Android 10 gestures. Go through the steps below to make changes. Step 1: Open the Settings app on your Samsung device. Step 2: Navigate to the Display > Navigation Bar > Full screen gestures > More options > Swipe from bottom.

How do I hide the navigation bar in Google?

On Android 4.1 and higher, you can set your application's content to appear behind the navigation bar, so that the content doesn't resize as the navigation bar hides and shows. To do this, use SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION .


3 Answers

Ok. So you need to set the navigation bar to be hidden right after you create the navigation controller for that tab. You cannot adjust this after you push the view controller (as far as I know).

If you want the first view to not have a navigation bar at the top, then use this in your appDelegate where you initially declare your navigation controllers:

localNavigationController = [[UINavigationController alloc] initWithRootViewController:theViewController];
[localNavigationController setNavigationBarHidden:YES animated:YES];

If you want the views after that to be hidden, then you need a viewController for the subsequent views, and you will have to add

[[self navigationController] setNavigationBarHidden:YES animated:YES];

right before you call this:

[[self navigationController] pushViewController:theThirdViewController animated:YES];

Hope this helps.

like image 137
Nabou Avatar answered Oct 18 '22 19:10

Nabou


Implement this:

[self.navigationController setNavigationBarHidden:YES animated:YES];

before assign the 3rd view. that is self.view = 3rd view

like image 26
Sisu Avatar answered Oct 18 '22 19:10

Sisu


Note that the code must be added in the viewWillAppear method

-(void) viewWillAppear:(BOOL)animated
{
      self.navigationController.navigationBar.hidden = YES;
}
like image 1
KeithTheBiped Avatar answered Oct 18 '22 19:10

KeithTheBiped