How to hide/show custom navigation bar? - ios

In my iOS application, I'm using custom NavigationItem (added to root view from Nib file). For default NavigationItem I can use
[self.navigationController setNavigationBarHidden:YES animated:YES];
to hide them, but I didn't find any way to hide my custom NavigationItem or removeFromSuperview, could somebody please kindly show me some pointers?
Thanks in Advance!

with [self.navigationController setNavigationBarHidden:YES animated:YES]; you hide the complete navbar and not only the navItem. As far as i understand you added the navitem as a subview. You have to keep some kind of reference to the UIVview eg. with a property or a tag and then remove/hide the navItem.
Since you just hide the navBar it is still there. So you can move you views with their frame property.
So I guess you it is enough to move the content views and skip the hiding / removing at all.

you should create outlet for your navigation item and the you can animate/hide by writing code your self

Related

Unable to hide Navigation Controller's tool bar

I have a controller (Search Controller) thats embedded inside a navigation controller and a tab bar controller. I then have a container view inside Search Controller that embeds a navigation controller.
For some reason I cannot hide the navigation controller's tool bar that is embedded inside the container view. This is how I am attempting to hide the tool bar.
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setToolbarHidden:YES];
[self.tableView reloadData];
}
No matter, the tool bar at the bottom of my controller will have a tool bar that covers my container view's content. Any ideas why this is happening and how I can hide the toolbar/(tab bar?)? Thanks.
Picture of the problem:
I'm not sure exactly what was going wrong or what the proper fix was. But to 'kind of' fix the problem, I simply enlarged the container view underneath my tab bar so that the tab bar I am unable to hide is hidden beneath my universal tab bar.
Try to use:
self.tabBarController.tabBar.hidden = true;

How to make UIView go fullscreen when entering edit mode

I have a UITableView that renders in the context of a UINavigationController (and maybe even a TabBarController). There is a way to make the UITableView enter editing mode. When that happens I want the table to get 'focused' and the navigation bar and tab bar to go away (the table view has to expand to fill the empty space). Then when editing mode completes, it should all go back to normal. Anyway to achieve this with standard iOS view and controller functionality. Or do I have to start hiding controls and resizing the view manually?
You could use a modal view to accomplish this.
Have a look at the documentation for [UIViewController presentViewController:animated:completion:]
If you just want to show the UINavigationBar and the UITabBar to disappear, you can just use:
[self.navigationController setNavigationBarHidden:YES animated:YES];
Otherwise, you can show an editable version of the UITableViewController and push it onto the navigation stack:
viewController.hidesBottomBarWhenPushed = YES; // this property needs to be set before pushing viewController to the navigationController's stack.
[self.navigationController pushViewController:viewController animated:YES];

Safe way to remove tab bar from UITabBarController in ios

I want to use UITabBarController but I do not need a tab bar because I'm going to switch tabs from the menu in another view controller. I want to remove it as it will be never used. I've created a subclass of UITabBarController and put this code:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tabBar removeFromSuperview];
}
Is that safe to remove tab bar that way?
Update: Why tab bar controller?
Apple suggests to use standard container view controllers whenever it possible. I'm trying to follow that. My screens workflow is the same as for tabs, except that they are switched by left side menu, not by the tab bar.
When I use a UIViewController and change it's child view controller I've got a lot of problems when autolayouts are not working properly.
The other reason is that I want to use story board, rather then create segues from the code so I can see my app workflow easily.
When you are saying, you don't want to use it, then why to remove it. You can go with a
tabbarcontroller with hidden tabbar. I am switching tabs from the bottom custom bar.
I am doing an app, which has a tababr controller with three items. Instead of using system tab, I am creating a custom view at the footer like tab & have actually set the hidden property of tabbarController's tabbar to YES.
myTabBarController.tabBar.hidden = YES;
Try this code
[app.navigationController.view removeFromSuperview];
[app.tabbarcontroller.view removeFromSuperview];
[app.window addSubview:app.navigationController.view];
[app.navigationController popToRootViewControllerAnimated:YES];

Hide bottom bar on demand

I have a UINavigationController inside a UITabBarController. I'm presenting a sort of popover view using a semi-transparent UIView, but am not calling presentModalViewController or any of the usual methods. I know about hidesBottomBarWhenPushed, but is there a way I can hide the bottom bar (or even betterm slide it out) on demand (just before my subView is added to the navigationController's top view)?
Have you tried setting this property?
navigationController.toolbarHidden = YES;
Or with animation:
[navigationController setToolbarHidden:YES animated:YES];
See answer https://stackoverflow.com/a/9141766/305351 to related question.
Specifically Borut Tomazin's comment and his solution https://gist.github.com/borut-t/6507423.

UINavigationBar moves my view

I have a UINavigationBar that is hidden most of the time my app is running.
however when i was it to show i call
[navigationController setNavigationBarHidden:NO animated:YES];
the view currently showing is resized..
i then unchecked the "auto resize" option in interface builder.
now the view is moved down.
i there a way to load the navbar over the top of the view so it does move my view?
Many thanks
You need to put your own navigationbar by picking from the Library.
use this code and put your navigation bar in the XIB of the view.
[navigationController setNavigationBarHidden:YES animated:YES];
Other wise your view will be come down by 44 points the height of the navigation bar.

Resources