I have a tab bar that works as normal. However, I'd like for one of the buttons to have a view controller pop up modally, which will hide the tab bar. When it resigns, the tab bar will re-appear. I've seen this in other apps but I'm at a loss how to accomplish this. Any help is greatly appreciated, thanks!
Why not?
Make segue between ViewControllers in your storyboard. You should ctrl+drag from one ViewControllers to another.
In the UITabBarDelegate method tabBar:didSelectItem:(UITabBarItem *)item, implement
[self performSegueWithIdentifier:#"segue identifier" sender:someObj];
Related
I am using TabBarController with four tabs in my applicatin. In the second Tab I'm using PageViewcontroller. PageViewController contains Five pages. Where the first Page view contains the button. On button click we can navigate to another view. When we navigate to another view, the tab is going to hide.
But I don't want to hide the Tab bar.
Anyone can please help to resolve this problem.
Thanks
In order to make UITabBar visible in all the screens of your app you need to take UINavigationController for all the tabs, UINavigationController will be the viewControllers with relational segue and UINavigationController's root view controllers will be your initial controllers which you want to show on Tabs
Below is the screenshot of how you design it using your storyboard
And here is how it works
Deselect Hide bottom bar on push as below :
Or programatically :
yourViewController.hidesBottomBarWhenPushed = NO;
I am using SWRevealViewController and tab bar view controller. A table view is hooked to the back of the tab bar. If I select any of the cells,the view transitions to the correct view but my tab bar buttons disappear. This is the hierarchy of the views:
SWRevealViewController - > SideTableViewController - > tab bar controller >tab 1
Not sure what is going on. Please help. Thanks!
I had a similar problem when using SWRevealViewController. What I believe is happening is that you are linking to one of the individual TabBar Views, instead of linking it to the TabBarViewController. But, without a picture of your storyboard, I can't be 100% sure
I instantiate my UITabBarController by calling navigationController.viewControllers = #[[self.storyboard instantiateViewControllerWithIdentifier:#"tabController"]];
My Tab bar controller has a child view that is embedded in a navigation controller. However the bar button (item) is unresponsive when I touch them (the buttons in the navigation bar). I have tried logging the action but it appears as if the button is not firing at all.
The only thing that I have done differently is the way i instantiated the tab bar controller. Am I missing something?
I connected the navigation bar button from the storyboard to an action so it is hooked up successfully. Please note there is also a navigation Controller pointing to the UITabbarController not shown below.
The unwanted behaviour maybe because this flow (navigation controller to tabbar controller) is ill advised in the Apple HIG. More information can be found here: Storyboard with NavigationController and TabController. The solution I found was to hide the navigation bar on the navigation controller that links to the navigation bar (can be done in interface builder), then make it reappear in the new navigation controller that the tab bar links to. Confusing I know, I can help anyone who ever has a similar issue.
Is there any specific reason you are doing this:
navigationController.viewControllers = #[[self.storyboard instantiateViewControllerWithIdentifier:#"tabController"]];
You can simply drag an outlet from the UITableViewController to the UINavigationController using only the Storyboard.
I think you forgot to add the navigationItem. In the storyboard, add a navigation Item to your viewController and move your bar button items to the navigation bar that appears on the top.
I have a app having two tabs. Also using a splitviewcontroller. I want to link the tab bar (tab1) controller with the splitviewcontroller so that when tab1 is selected splitviewcontroller should be shown.
I tried attaching modal segue from tab to splitVC. But no luck. is there any way to do this using storyboard?
Please help.
Regards,
Lalit
Both UISplitViewController and UITabbarController have arrays of viewControllers they display. So it's impossible to have them both on screen. But I think you can use UISegmentedControl instead of tabbar in one of yours views.
I have application with 2 tab bars. In second tab bar I have navigation controller. I want to change this navigation controller to another navigation controller when "Change" button is pressed. How can I do that? Please help me.
Thanks
You'd have to replace the View Controller in the TabBar using the viewControllers property of UITabBarController or setViewControllers:animated:if you want to add some animation.
But maybe you should think of having 2 views in a controller of yours and hide/show them when you click a button, maybe even pushing/popping view controllers without animation (pushViewController:yourController animated:NO) on the navigation stack of your navigation controller and just hide the back button (self.navigationItem.hidesBackButton = YES)