Tab bar controller is not showing bar button item - ios

I'm new in Objective-C, and even more using storyboards. This being said I'm trying to use a bar button item within UITabBarController and UINavigationController as can you see in the image below.
But once I run the project in simulator this item is not showing. I would appreciate a non programmatically solution if it's posible.

Okay, so the way to do this:
When you create your tab view controller. You have to add a navigation controller that will handle each tab.
Tab View Controller --> navigation controller --> View Controller 1.
Then add the bar button item to view controller 1. Then go ahead and add the segues.
Now, still it won't show up.
But, if you go to your code for your view controller 1: Add a reference from the storyboard of your bar button item into your View Controller 1 file. Then, in ViewWillAppear():
self.tabBarController.navigationItem.rightBarButtonItem = _btnNewContact;
From there, it will show up and the segue you have configured in your storyboard should work perfectly! =)

After I spent a while trying to get the best way to do it I finally did that I should have done since begin. Read official apple documentation.
Parameters
viewController
The view controller that is pushed onto the stack. This object cannot be an instance of tab bar controller and it must not already be on the stack.
In other words, my approach is just a bad design.

Related

Using UITabBarController with UINavigationController - Swift 3

I am making an app which requires a use of a UITabBarController along with UINavigationController. I have made the following flow in storyboard.
See image
Now the first question is that is this accepted by Apple, as there are too many discussions for the same.
The other matter of concern is that is it possible to eliminate any UINavigationController and still get the same flow of the app? The main thing required is to have the SAME tab bar and navigation bar on all sub tabs of the tabs. One point to be noted is that if I remove the second UINavigationController then my app navigates directly from sub tab to home view controller on clicking back button.
I have been stuck on this since hours now. I am new to iOS app development and have never uploaded any app to the app store. Any help would greatly valued.
EDIT :
I put the second navigation controller as shown in the answers - see this flow, But because I have a navigation controller before the HomeViewController, so I am getting a navigation bar at the top and then some empty space below that(exactly equal to the top navigation bar) and then the page contents on runtime. Any solution to this?
Yes, it is acceptable by Apple.
But View hierarchy is not managed correctly. In your case Tab bar will be the root view controller for 2nd navigation controller.
Also, Tab and sub tab you are pushing will be part of 2nd navigation controller.
That's the reason you are getting back on Home view controller.
It's good practice to keep navigation controller to each Tab to manage it's sub-tab hierarchy.
You could present tab bar controller or setviewcontroller from Home View controller.
First embed tab bar controller as in this image and the embed navigation bar controller as in this image finally this will look like

tab bar controller disappears after modal segue

I am new to this and really struggling, I have searched on here but the answers to this question don't seem to work with what I am trying
the user selects the store name (button) to present modally a new view controller. but then the tab bar controller disappears, and I cannot get it back. Is there a way to add new view controllers that will always have my tab bar controller? i.e. new "tabs", that will only be displayed if the user decides to push the button regarding that tab. I am using Xcode 6.1 with storyboards
I don't know if I got it right, but if you want to show a new View Controller and you want to keep showing the tabs you have you should use a NavigationController inside your TabBarController and then do a push, not present modally;
Your storyboard should look like this:
http://timroadley.com/wp-content/uploads/2012/02/HighLevelStoryboard.jpg
Hope it helps!

Using UITableViewController in a navigation bar

I'm new to iOS, but I know the basis. I want to host 3 UITableViewController in a UITabBarController using the storyboard.
I dragged a UITableViewController from the object list(?) and control dragged creating a seguel. Now the tab shows successfully the table view controller.
The issue is the rows are taking the space of the status bar. So I want a navigation bar(?) there, with a title. Since I'm new to iOS I don't know the following:
Given the fact that UITabBarController is the first controller ever, the hosted UITableViewController should not have a back button, obviously. So is it correct to use a navigation bar to display a title (and possible add/edit buttons)
If so, I tried dragging the Navigation Bar but it doesn't work.
What am I missing or doing wrong?
hope this helps
actually it is done for another answer. but it will be handy to u too
You will want to add in 3 UINavigationControllers. Have each tab in the tab bar controller segue to a different navigation controller. Then set the root view controller for each navigation controller to one of the table view controllers.

Tab bar disappears when trying to go back from new view

I am very new to Xcode and have encountered an issue with my app. I am trying to create a tab bar app. On one of the tabs I have a button that brings the user to a different ViewController. I want to have it so the user can select a button that would return them to the tab that had the button. I tried to set up an action from the button to the previous view (the tabbed screen), however the tab bar disappears. I hope this is makes sense.
Here is a link to a screenshot...
Easiest way to do this is to place a UINavigationController as the root view controller of the TabBarController. You can do this in storyboard by simply ctrl+dragging from the tabbar controller to the navigation controller and adding it as a relationship.
Here's an example using storyboards:
The next step is to set the third controller (in this case the table view controller) to your player view controller class.
Then, you can use the default back button and animation that comes with the navigation controller. If you prefer to hide the navigation bar at the top of the screen, then you can use your custom back button to call
[self.navigationController popViewControllerAnimated:YES];
You can also choose custom animations / segues, etc. but using a navigation controller to help you navigate screens is probably the simplest approach.

ios storyboard tabbar > ViewController > TableView

I would like to create the following navigation
I have a tab bar program build with storyboard
and I have a View controller with buttons
when I click a button A navigation controller is called
Right now I have made all the connections and everything works fine but..
in order to create the change from the button to the table view I am using modal segue and that removes my tab bar.
I know that push will not work cause its not a navigation but how can I work this out?
I had the same problem but I realized that the best option is do it using a push segue. It's the best option because when you have a table view into a tab bar item it's more usability, it's what customer want. I'm sorry for not solution your problem but I strongly recomend you to use push.

Resources