IOS TAb bar cannot hide on subView - ios

I'm learning IOS now, and working on Tab Bar Veiw Controller. I want to hide the tab bar on sub view, so I set 'Hides Bottom Bar On Push' true, it's working fine on second view. But if I set it true on Third View, the Tab Bar is not hidden.
How can I hide the tab bar when third view push?
I already try to find the result on line, but cannot find, please help me.

You can follow code below, hope can help you
DetailViewController *detailViewController = [[DetailViewController alloc] init];
detailViewController.hidesBottomBarWhenPushed = YES;
[[self navigationController] pushViewController:detailViewController animated:YES];
[detailViewController release];

Related

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];

xcode tab bar controller change selected item with code

Firstly,I'm using Xcode 6 and Objective-c. I want to change tab bar screen with button or automatically with code how can i do this.Another question may i do this different view not a item of tab bar controller.
- (IBAction)backButton:(id)sender
{
ProfileSide *vc = (ProfileSide *)[[self.tabBarController viewControllers]objectAtIndex:1];
[vc.view setNeedsDisplay];
[self.tabBarController setSelectedViewController:vc];
}
I tried this code part but not working. ProfileSide name of the class 3rd item tab bar controller.
ProfileSide *vc1 = [self.storyboard instantiateViewControllerWithIdentifier:#"meScreen"];
[self presentViewController:vc1 animated:YES completion:nil];
Also have got this code part but when i use this one tab bar get disappear.
[self.tabBarController setSelectedIndex:yourIndex];

Pushing a UITableViewController from a tabBarController embedded view doesn't remove tab bar?

I have a tab bar controller with 4 tabs and each tab is their own UINavigationController, which is how you're supposed to nest tab bar and navigation controller's together. The initial tab is a TableViewController and works/appears the way that it should. From the tableVC I can push standard view controller's onto the navigation controller with:
[self.navigationController pushViewController:VC animated:YES];
and it works properly.
If I attempt to push another TableViewController onto the navigation with the same method it works the same way, but the initial tab bar does not get pushed off screen like it should, it just stays in place.
Why would the tab bar stay on screen even though I am pushing a new VC onto the navigation?
I have tested with multiple instances of different TableVC's and it only happens with a table view controller.
Here is the code I'm using:
- (void)pushTableVC
{
TestTableVC *tableVC = [[TestTableVC alloc] init];
[self.navigationController pushViewController:tableVC animated:YES];
}
This will push the new table view onto the stack, but the tab bar from the parent VC stays in place and does not get pushed off screen like it should.
You should call the method setHidesBottomBarWhenPushed: on the view controller you are pushing to correctly hide the tab bar.
UIViewController *viewController = [[UIViewController alloc] init];
[viewController setHidesBottomBarWhenPushed:YES];
[[self navigationController] pushViewController:viewController animated:YES];
When you use a UITabBarController, the tab bar always stays on screen, even as you push additional view controllers onto an embedded UINavigationController. You will see this in any app that has a UITabBarController implemented, unless they implement custom behavior to change this.
The UINavigationController contains everything above the UITabBar, but does not contain the UITabBar itself, so it would not be able to push it offscreen.

how to go to tab bar controller after clicking the respective button

I have structure of project as shown below.
On the left side I have MainViewController. There I have two buttons as English and Arabic. What I want to do is when I click English, I want to go English tab bar controller (HomeViewController).
Hence what I wrote is
- (IBAction)langEnglish:(id)sender {
HomeViewController *secondView = [self.storyboard instantiateViewControllerWithIdentifier:#"enghome"];
[self.navigationController pushViewController:secondView animated:YES];
}
This is working perfectly, but I don't see tab bar.
Tab bar is missing from this.
Any idea what is going wrong?
Basically what I have is view controller as main controller and upon clicking button on this controller, tab view controller should get open...
Go to your main storyboard and select your main view controller. On top select Editor->Embed in->navigation bar.
EDIT: If this does not work push to your tab bar and use this code:
self.tabBarController.selectedIndex = 1;
What I did is as below
- (IBAction)langEnglish:(id)sender {
EngTabViewController *secondView = [self.storyboard instantiateViewControllerWithIdentifier:#"engtab"];
[self.navigationController pushViewController:secondView animated:YES];
}
EngTabViewController is the UITabBarController and I assigned id to tab bar controller... this works like charm...
Means instead of viewcontorller, I used tabbarcontroller...
You shouldn't push a UITabBarController on a UINavigationController. Set it as the window's root view controller instead and the tab bar should be displayed as expected.

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