How to display Navigation bar when tab bar item clicked - iphone

I m working on Iphone application which is having UITabBarController and UINavigationController
I am switching to UIWebView in flow of the project before which its all Native
When I switch to webview I am able to hide the Navigation bar
but when I clicked on a tab which brings it to home page I cant see navigation bar unless I select any option and go to next view
I did find out abt tabbar function
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
but I m not getting how to unhide or display the navigation bar again??
Please help

I guess you use
self.navigationController.navigationBarHidden = YES;
to set the navigationController's navigationBar to hidden.
If you use this in the other views in viewWillAppear you need to set it to non hidden again
self.navigationController.navigationBarHidden = NO;

Related

How to remove "More" tab in UITabBarController that has custom tab UI (not using tab bar)

I'm using a UITabBarController as a backing to present multiple view controllers, but I'm not using the default tab bar at the bottom for the user to tap on the tabs. Instead, I'm presenting a slide-out menu from the left that displays a list of tabs in a table view. So the user can tap on one of the cells in the table view and switch to that tab. This is a very common paradigm for displaying multiple view controller tabs without using the tab bar at the bottom of the UITabBarController.
Now that I've added more tabs, I'm having an issue with one of my tabs opening to UITabBarController's "More" controller. I don't need or want this "More" controller because I'm displaying my tabs in a scrollable list, not in a tab bar that has finite space.
How can I remove the "More" tab or tell my UITabBarController not to present the "More" screen? Is there some option to disable this?
A workaround: Find the right timing for hiding more navigation bar. Add those code to your subclass of UITabBarController:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (self.viewControllers.count > 5)
{
self.moreNavigationController.delegate = self;
}
}
in navigation delegate callback:
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
navigationController.navigationBarHidden = YES;
}

UITabBar and UINavigationController

Let me make the question more clear.
I have tab bar application with navigation controller included in each tab.
When click the tab 2 i go to login screen. From login screen i navigate to next screen (say screen 2) using login button. When i am on screen 2 if i cilck the tab 2 i again go to login screen. I do not want this. I want application to remain at same screen even if tab 2 is clicked again.
If i cilck any other tab in between then it works as expected.
How to achieve this??
- (BOOL)tabBarController:(UITabBarController *)tabBarController
shouldSelectViewController:(UIViewController *)viewController {
if ([tabBarController.selectedViewController isEqual:viewController])
return NO;
}
return YES;
}
Alternatively, you can catch taps on the tab bar and check if the selectedIndex changed or not.
The UITabBarController will pop to the root view controller if you tap a tab that you are currently displaying. To prevent this behavior take a look at this question:
Disable action - user taps on tabbar item to go to root view controller

Removing the tab bar

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;

How i calling UITableViewController in UITabBarController screen using Navigation bar on button click in iphone?

My i have to develop simple window based iphone application.
In my first screen I design the UITabBarController with four TabBarButton.On first Tab screen contains three buttons.
When i click on of the button, the screen should navigate on simple tableView screen.But tableView screen the TabBarController should have be visible. Means simply first replacing with table view and move back to again previous one(The UITabBarController should be visible on all srceen).
Wrap your root view controllers in UINavigationControllers. Then, add the UINavigationControllers to the UITabBarController (so there should be 4 UINavigationControllers, one for each tab). When the button is clicked in the original view controller, do something like:
-(void) buttonClicked {
SimpleTableViewController *tvc = //etc
[self.navigationController pushViewController:tvc animated:YES];
[tvc release];
}

Show/Hide TabBarController in iphone

i am making an application in iphone in which i have 4 tabbars & in one of its tab i have 4 views in 2nd view it needs to hide the tab bar. I am able to hide the tab bar using the setHidesBottomBarWhenPushed:YES in in the initWithNib method of the Viewcontroller being pushed. But when navigating to the screen 3 , calling the same method with "NO" does not make the tab bar appear. any ideas?
John Smith is correct. The URL for that sample is: http://developer.apple.com/iphone/library/samplecode/TheElements/index.html
The code that does this is in AtomicElementViewController.m, and the line that achieves this effect is in the init method:
self.hidesBottomBarWhenPushed = YES;
I had the same issue to show or hide tab bar controller with UITableViewController customized class. Somehow, by using the following codes, does not work to hide tab bar controller:
- (void) viewDidLoad {
self.hidesBottomBarWhenPushed = YES;
}
In the case of storyboard with segue, initWithStyle: method does not get called.
Instead, I have to overwrite the property to make it work:
- (BOOL) hidesBottomBarWhenPushed {
return YES;
}
My case is for iOS 5.1 with storyboard and segue to push to the next view (where I want to hide tab bar controller).
Take a look at Apple's Elements projects. They hide and unhide the tab-bar when you view and individual element.
Before you push your 3rd view onto the stack, set the 2nd view's hidesBottomBarWhenPushed to NO.