Removing the tab bar - iphone

In most part of my iPhone application I want to show things with navigation controller and tab bar.
But for few screens I need more space so I want to remove the tab bar.
I found before calling the controller that doesn’t need the tab bar I can set to hide it,
CardImageViewController *cardImage = [[CardImageViewController alloc]
initWithNibName:#"CardImageViewController" bundle:nil];
cardImage.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:cardImage animated:YES];
[cardImage release];
The problem is now I can’t get it to display again. If I set
xxx.hidesBottomBarWhenPushed = NO;
for the next controller still I can’t see the tab bar
How do I get it to display.

The bar will remain hidden until you pop that controller that you hide off the navigation stack.
Refer to: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html
One way to solve this is to present modal view for those controllers that you want to hide the tab bar

In which view you want tab Bar hide use
cardImage.hidesBottomBarWhenPushed = YES;
this before push
and now in viewWillDisAppear of same view you need
cardImage.hidesBottomBarWhenPushed = NO;

Related

Properly manage nav bar and tab bar

The figure shows my storyboard, with segues as directed.
In the tabBar's landing viewcontroller (i.e. I), both tabBar and navBar are visible which is desired. However, if a segue is performed (from I) to go to another viewcontroller (here, II), I want only the navBar. I am able to hide the tabBar by using
self.tabBarController?.tabBar.isHidden = true
Next, I am able to achieve the desired result by adding navigation controller at the beginning as shown below.
This configuration will add a navbar to the viewcontrollers ahead (like splash screen) so I will have to hide the navbar in those viewcontrollers.
Is there other method that does not require to hide the bar(s) and achieve the desired effect?
You should go with your first approach. Tab bar controller have default property to hide bottom bar. See below sample code.
ViewController *viewController = [[ViewController alloc] init];
viewController.hidesBottomBarWhenPushed = YES; // This property needs to be set before pushing viewController to the navigationController's stack.
[self.navigationController pushViewController:viewController animated:YES];
This will hide your tab bar while pushing to any child controllers.
EDIT
You can also set hidesBottomBarwhenpushed from storyboard for your tabbar controller so you don’t have to write down any code.

When going back from Flip Side of Tab Bar, Tab Bar Doesn't Load. iOS

So I have a tab bar app with three tabs. In the second tab, I have a button that loads another view in which two text fields pass their values into two labels in the original tab view. When I click the button, enter my values, and click the set button to go back to the original view, the labels are changed, but the tab bar doesn't load. How do I load the tab bar after switching from a different view?
Code for when the button in the original tab bar view is pressed
TeamNameViewController *fvc = [self.storyboard instantiateViewControllerWithIdentifier:#"99"];
fvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:fvc animated:YES completion:nil];
Code to go back to tab bar
SecondViewController *tempView = [self.storyboard instantiateViewControllerWithIdentifier:#"SecondViewControllerSB"];
tempView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:tempView animated:YES completion:nil];
The short answer is: You don't.
presentViewCntroller:animated:completion presents the target view controller modally. The other views still exist and you don't need to instantiate them again, you need to dismiss the modal view controller.
You need to call dismissViewController:animated:completion on the presenting view controller (that is the view controller that calls presentViewController:animated:completion is responsible).

Nav Bar disappearing on popviewcontroller

On one of my views, when a button is pressed I call another view that is a SplitViewController. If this SplitViewController is called via one of these buttons I have special objects to add to the view. mostly just nav bar items, like a cancel button. This view can be accessed elsewhere and these items are not needed which is why there is the special condition.
However, when the user is done and i pop the ViewController back to the previous screen that was selected, the nav bar disappears on that screen. I am not setting it to hidden nor am I doing anything strange with the nav bar. Simply adding the SplitViewController then popping back.
Some code..
//declare the split screen VC
SplitScreenViewController *split = [[SplitScreenViewController alloc] init];
//set the flag that this VC is coming from a button, so we need the extra nav bar items
[split setIsFromButton:YES];
[self.navigationController pushViewController:split animated:YES];
now the call back is simply...
- (void)cancelSelectionBtnClicked
{
[self.navigationController popViewControllerAnimated:YES];
}
and when the view returns, the nav bar is gone.
any ideas?
edit it should be noted this exact same thing is done elsewhere the same way(as far as I can tell) and the nav bar is visible on return.
In your ViewController's viewWillAppear you can again make your navigationBar visible.
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO];
}
I have seen various strange navbar behavior in UISplitViewController's, and in a few cases it was because the controller was not set as the rootViewController of the window as opposed to inside a navigation controller like you have set up.

Hides Bottom Bar On Push doesn't work

I have UINavigationController, that contains TabBarController.
Tab Bar child controllers always hide bottom tab bar, no matter "Hides Bottom Bar On Push" selected or not.
Tried to set programmatically:
downloadViewController.hidesBottomBarWhenPushed = NO;
[self.navigationController pushViewController:downloadViewController animated:NO];
but still no effect.
Solved by removing navigation controller,
and adding navigation controller for each tab.

problem with tab bar, not displaying the tab bar upon navigating to that page

In my test project I have some 5 tabs on click of a tab it will go to that corresponding class, on click of back in that screen I will come back to my home page but with out the tab bar.. earlier what 5 tabs were there those are not coming ...
following code I am using under back button
where DataEntry is the class to where i need to navigate
- (void) back_Clicked:(id)sender
{
DataEntry *avController;
UINavigationController *addNavigationController;
if(avController == nil)
avController = [[DataEntry alloc] initWithTabBar];
if(addNavigationController == nil)
addNavigationController = [[UINavigationController alloc] initWithRootViewController:avController];
[self. navigationController presentModalViewController:addNavigationController animated:YES];
}
is I have to add that navigation controller to the tab view? how can I get the tab bar on click of back can any one help me ,thanx in advance
As I understand this, you must already be pushing this view controller either via navigation controller or modally. So the idea would be to simply dismiss it right?
If you have used [self.navigationController pushViewController:animated:] then just do [self.navigationController popViewControllerAnimated:YES]; . This should take you back to the earlier view controller.
If you have presented this modally like you have done here, you should do [self.navigationController dismissModalViewControllerAnimated:YES];.
If you need to return back from a view to the previous view using a back button inside a tab view , i would recommend using a navigation controller inside the view for each tab where you require this functionality. Trying to implement a custom back button without using the navigation controller, in my opinion, is only making things tough for yourself.
If you only want one view to be displayed when you tap on a tab bar button then an ordinary view controller inside the tab bar view should suffice.
The tab bar shouldnt be disappearing altogether unless its been implemented incorrectly.