Remove tabBar from view - iphone

I have a tab bar app w/ the following drill down flow:
view 1 > view 2 > view 3 > view 4
I'd like to remove the tab bar from view 2 and keep the tab bar on views 1, 3 and 4.
I tried setting the code below when loading view 2.
vc.hidesBottomBarWhenPushed = YES;
The code successfully removes the tab bar on view 2, but I can't get the tab bar to come back on views 3 and 4. I assumed I'd be able to set YES to NO (vc.hidesBottomBarWhenPushed = NO;) when views 3 and 4 are selected to bring back the tab bar, but that doesn't work.
How can I remove the tab bar on view 2 only (keep the tab bar on views 1, 3 and 4)?

Overwrite the init function (loadView probably won't work) for views 3 and 4 and set
self.hidesBottomBarWhenPushed = NO;
That should work.

Related

Swift 3: Show Tab Bar on an other ViewController

I'm using a tab bar which is connected to 3 viewControllers. What I want to do is when I click the some rows on my main viewController, I want to keep my tab bar for this page.
This is my main viewController on the tab bar:
When I click on a tableView's row on the left side, I want to keep the tab bar on the other page in its place. I guess I have to do something in the prepare for segue function. What do you guys think?

No top navigation bar in a tab bar controller application

I'm pretty new in iphone programming and have stumbled upon this issue which I guess should be pretty basic stuff.
I am using a tab bar application created from a template in XCode IOS 5.1. It works fine and creates 3 screens in the storyboard (tab bar controller + + 2 descended views) but when I try adding a top bar to these 2 views there is a problem...
I do this by adding the top navigation bar in interface builder from object inspector for the tab bar controller. After ticking this option the top bar shows perfectly in my storyboard for all 3 screens (tabbarcontroller + 2 descended views) but after I run the project the top navigation bar is no longer there.
What am I missing here? Why is there no top bar?
If you want to show a navigation bar on two ViewControllers of your tab bar based application, then you can do as follows:
Delete the viewcontroller1, then drag ViewController into storyboard from library and select it and go to Editor\Embed In\Navigation Controller.
From the UITabBarController, click on tabbar and right click, select relationship and drag it to the navigation controller. (means add the UINavigationController as a tab).
Hope this helps!
follow as Nuzhat Zari to show navigation bar on viewcontrollers of your tabBar based application
self.tabBar.frame =CGRectMake(0,0,self.view.frame.size.width,50);
This will make Tab Bar to appear at the top of controller.

Tab bar controller selectedIndex or SelectedViewController accessor

I have created a tabbar based application which contains, let say, 3 tabs. In my first tab, I have 3 UIButtons. on clicking button 1, a new viewcontroller 1 is loaded and the tab 1 is highlighted as selected. On clicking button 2, a different view is loaded (Viewcontroller 2) and tab 2 should be highlighted as selected tab (Remember, this viewcontroller 2 is not the root view controller of tab 2) and on clicking button 3, again a new view is shown (viewcontroller 3) and tab 3 should be highlighted as selected (Remember, this viewcontroller 3 is not the root view controller of tab 3).
So, what I want to do is, I want a particular tab to be shown as selected (or highlighted), but dont want to load its root view controller.
I have tried using tabbarcontroller.selectedindex = 1 on clicking of button 1, but it went in vain. Because what happened was tab 1 got selected and the view being shown to me was not viewcontroller 2. Instead it was the root view controller of tab 2. Somebody pls get me out of this mess....
If that is indeed your requirement, the best way is to create a 'fake' tab bar using custom uiimageview. You will need three imageview and change the images accordingly as you tap the buttons.

can i add more than 8 tabs on TabBarController?

Can I add more than 8 tabs on UITabBarController?
My code is here:
UITabbarController *tabbar=[[UITabbarController alloc]init];
tabbar addTabItems......
You can add as many view controllers to UITabBarController as you want. The right most tab button will be called More with three dots which will take you to the screen where you can edit which view controllers to show and which ones to hide.
Yes you can add 8 tabbars but only 5 will be visible and for remaining, it'll show you a dotted tab on clicking that tab it'll show the list of remaining tabs in your tabbar.

How to show and hide tab bar at required places?

Hi i am making an application where ther are four screens(view controllers) from 1 to 4. I want to show screen 1 without tab bar .This screen will have three buttons through which user can navigate to other screens. Now when user taps screen 2 button then user should navigate to screen 2 with tab bar on bottom.Now this tab bar will have four tabs from screen 1 to 4 to navigate .Similarly when now user tap on tab 1 then the scrren 1 should arrive which is without tab bar and so on.
My problem is i am not able to load or unload tab bar at required places.I have tried following:
I opened screen 1 on statrt up and on screen 1's view did load added the tab bar but it didnt work
I added tab bar on main window but then tab bar starts to show even on screen 1.
PLease tell me the correct way to do this (In other words a tab bar with four tabs in which the first screen should not show tab bar)
Thanks in advance
use this single line
self.hidesBottomBarWhenPushed=YES;
for hide tab bar. use this before push the page where you want tab Bar hidden and also write this line
self.hidesBottomBarWhenPushed=No;
at same page from where you are going to push in viewWillDisappear.
self.window.rootViewController = self.navigationController;
First add your rootviewcontroller in the window.
and add three buttons in it.
on clicking event of button add tabbarcontroller to mainwindow
AppDelegate *delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
delegate.tCtr.selectedIndex = btntag; //ur button tag;
delegate.tCtr.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:delegate.tCtr animated:YES];