how to hide tabbar when I use NavController to push view? - ios

I have tried two kinds of methods below:
1.[self.tabBarController.tabBar setHidden:YES];
2.
self.navigationController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:OneViewController animated:YES];
But the result is that the tabbar items is hidden, but there is still a black block there,
I guess it is because the view's tab bar style is not set to None.Just like the IB's view setting below:
How to solve this problem, thx

To hide the nav bar use this code
[[self navigationController] setNavigationBarHidden:YES animated:YES];
To show the nav bar you can use this code
[[self navigationController] setNavigationBarHidden:NO animated:YES];
And here is the doc's that might be helpful my friend
https://developer.apple.com/library/ios/ipad/#documentation/uikit/reference/UINavigationController_Class/Reference/Reference.html
Hope that helps you man.
EDIT
Here is a github project for hiding the tab bar. Hope this helps you.
https://github.com/idevsoftware/Cocoa-Touch-Additions/tree/master/UITabBarController_setHidden
Let me know if this is what ou are looking for and if you need more help man.

Related

How to create a navigation bar in a view controller using xib programmatically in objective c?

can somebody please help me to solve this, I didn't post my code because im confused with some codes so I need a set of code to create a navigation bar and navigation items in a view controller without navigation controller...kindly help me
Hope this helps :
https://stackoverflow.com/a/21449603/8013132
To hide navigation bar:
[[self navigationController] setNavigationBarHidden:YES animated:YES];
To show it:
[[self navigationController] setNavigationBarHidden:NO animated:YES];

how to hide navigation bar + toolbar and change tableView height on scroll

I've got a view controller embedded in a navigation controller with a toolbar attached under it so it has this style:
as you can see with my storyboard, i also have a container view with a tableviewcontroller inside:
on scroll, i need to hide the navigation bar which I've been able to do. The problem is, I have to also hide the toolbar that is under the nav bar as well as expand the height of the table view so that when the nav bar and toolbar both disappear, the table view can use the extra space.
I don't have perfect answer but try to use below code in cellForRowAtIndexPath
will help you..
you did not mentioned weather your code is in objective C/ Swift. I am providing you Both ::
Obj-C
[[self navigationController] setNavigationBarHidden:YES animated:YES];
Swift
self.navigationController().setNavigationBarHidden(true, animated: true)
For tabBar, If you want to hide tabBar with navigationBar use this thing..
Or use this for tabBar hide >
DetailViewController *detailViewController = [[DetailViewController alloc] init];
detailViewController.hidesBottomBarWhenPushed = YES;
[[self navigationController] pushViewController:detailViewController animated:YES];
[detailViewController release];

How to hide this back button?

I want to hide this back button drop down every time I swipe rightwards.How is this possible?
I need a code which I can use it in AppDelegate so that i can use it globally rather than changing it for every ViewControllers.
Select your Navigation Controller and Uncheck Shows Navigation Bar as per below Image
self.navigationItem.setHidesBackButton(true, animated:false);
Well this code works in Appdelegate or in any ViewController.
In action of swipe rightwards add following line of code:
[[self navigationController] setNavigationBarHidden:YES animated:YES];
If you want to show it again use following code in appropriate method:
[[self navigationController] setNavigationBarHidden:NO animated:YES];

XCode/iOS: setToolbarHidden:animated creates new unwanted toolbar?

I'm trying to achieve something similar to user of this post:
Xcode/iOS: How to hide Navigation- AND ToolBar on scroll down?
I'm able to hide (or unhide using NO) the navigation bar successfully using the code:
[[self navigationController] setNavigationBarHidden:YES animated:YES];
However, when I attempt to hide the toolbar using the code:
[[self navigationController] setToolbarHidden:YES animated:YES];
Nothing happens. I then noticed when unhiding the toolbar that I received an additional blue toolbar that I didn't realize existed. This screenshot shows this:
Screenshot
I do not want the blue bar. What I am trying to do is hide or unhide the Black toolbar with the icons on it. (the UITabBar).
I think what I need to do is somehow I need to access the navigation controller of one of the parent view controllers and call the setToolbarHidden on the navigation controller of that view. However, I can't seem to figure out how to do this.
I've tried the following and all seem to have no effect:
[[[self parentViewController] navigationController] setToolbarHidden:YES animated:YES];
or
[[[[[[UIApplication sharedApplication] delegate] window] rootViewController] navigationController] setToolbarHidden:YES animated:YES];
My view controller storyboard consists of the following:
The InitialViewController is a TabBarViewController. It contains three children. One of those children is a UINavigationController. This navigation controller gets several UITableViewController pushed onto it, and eventually a UIViewController is pushed. This last UIViewController is what is seen in the screenshot.
Rough Layout:
TabBarViewController
UIViewController
UITableViewController
UINavigationController
UITableViewController
UITableViewController
UITableViewController
UIViewController
I've tried using
[self parentViewController] parentViewController] parentViewController] ...
to attempt to get back to the top, but this hasn't seemed to work either.
Any suggestions?
I think the problem here might be related to UITabBarController not having a UIToolbar. The setToolbarHidden: method will only apply to the UINavigationController's built-in toolbar (see Apple's documentation). If it's the UITabBarController's tab bar that you actually want to hide, take a look at this post which links to a method using UIView animations directly on the UITabBar.

Show UINavigationBar

Here's the deal... I can't get the UINavigation bar to appear on one of my views. I have the whole thing in a NavigationViewController in IB and turned of the navigation bar though IB because I don't want it in most of my app but when I try to show the navigation bar via code, it doesn't show up.
here's the code I used to try to get the nav bar to show up... but didn't work:
[self.navigationController setNavigationBarHidden:NO animated:YES];
[self.navigationController setNavigationBarHidden:NO];
self.navigationController.navigationBarHidden = NO;
self.navigationController.navigationBar.hidden = NO;
Any help will be greatly appreciated
respectfully,
Matt
The code you write should only work inside of one of UINavigationController's controllers, not views.
So, if you call it from your view, you should replace self with controller name,in which this view is placed.

Resources