I have 4 main ViewControllers that are connected to a UITabBarController. These are the 4 main screens of my application. Each of these 4 screens has an icon on the TabBar.
Now, from within one of these main screens, I want to be able to click a button to show a new "child" view controller. When I segue from the MainVC to the ChildVC, the UITabBar does not show on the ChildVC. How can I get the UITabBar to remain shown? I do not want to add the ChildVC to the UITabBar, as it should not have an icon on the bar.
I am open to using any type of segue or combination of views.
Within MainVC, I want to click a button to show ChildVC WITHOUT losing the UITTabBar from the MainVC (and without adding ChildVC as an icon to UITabBar).
If I understood your question's hypothesis correctly, you should stack all 4 “main screens” into separate navigation stacks (UINavigationController).
So the outcome would be:
UITabBarController -> UINavigationController -> UIViewController (1 of those main screens) click button -> Desired UIViewController
Have a look at this: https://stackoverflow.com/a/27425271/8290785
Related
My current hierarchy is:
Tab bar controller
Navigation controller
A UIViewController
Another UIViewController
It shows tab bars at the second UIViewController (so number 4 in the list). I want to remove that tab bar, but I want to keep the navigation at the top. This is because the first UIViewController (number 3 in the list) holds a tableview, and when a user clicks on a cell it goes to the second UIViewController and I want to keep a back button.
An example is when you open WhatsApp, you have a list of conversations (left side of image). When you click on a conversation, the tab bar buttons at the bottom are gone (right side of image). I can hide them in the second UIViewController, but it causes some glitches. I am sure there is a better solution.
In presented/pushed viewController's viewDidLoad, or in the storyboard, set the view controller's hidesBottomBarWhenPushed to true.
I have an iOS app written in Swift with UITabBarController with 5 UIViewControllers. Now, I have a bunch of UIViewControllers that are not part of the UITabBarController. I'd like to be able to show that same tabbar but I have no idea how to do that. Any clue?
More details: This is one of the View Controllers that the tabbar has. I use storyboard references and split my view controllers into separate more manageable storyboards.
So, the big picture:
There's no initial ViewController since I use storyboardId to get to the initial Navigation Controller. From there we have a ViewController embedded in the same Navigation controller. In that ViewController, there are 2 Container views - one of the size of the bottom ViewController that contains the "hamburger" button that toggles the other Container View which has an embedded UITableView in. When a specific cell is selected it should go to Profile ViewController that's not even in the same storyboard. The segue is set to be Push. Either way, doesn't show the UITabBar on the Profile ViewController
how you doing?
I don't know if I understood, but you are trying to show tabbar after going to another screen, right? If the answer is 'yes', try to change your segue to show(e.g. push).
-----Edit-----
You can do with two ways:
Presenting Modally -> using Current Context
Use push(e.g.) with a navigation view controller, you can also hide the navigation bar if you go to Navigation controller -> Attributes inspector -> Navigation Controller -> Uncheck Shows Navigation Bar
Hope now it works!
Best regards
I want to push a view from the UITabBarControler. My app hierarchy looks like this:
UINavigationController -> UIView -> UITabBarController
I have a UITabBarController with 3 tabs. On the first tab, I have added a UITableView. How can I make it so that the selection of a cell in the table pushes to another view without navigating from the tab control?
Your problem is the arrange you are doing.
You are using UINavigationController -> UIView -> UITabBarController, so UITabBarController is a subview of the UINavigationController. When you navigate, the view you are popping is FROM THE NAVIGATION CONTROLLER, so ALL its content (including the UITabBarController) will disappear.
You structure needs to be like this:
UITabBarController -> UINavigationController -> UIView, which means one UINavigationController per every tab that needs it.
For example, if you need to use push inside two tabs, the structure should be like this:
UITabBarController
| --> UINavigationController 1 --> UIView 1 --> (push segue) --> UIView 1B
| --> UINavigationController 2 --> UIView 2 --> (push segue) --> UIView 2B
If you really want a navigation-controller type push inside the tab bar interface, you need a navigation interface inside the tab bar interface.
Your simplest solution, though, might be to reconsider your interface.
Like this:
How to handle UINavigationControllers and UITabBarControllers iOS 6.1
That's a more complicated version, but take a look at the Tab Bar Controller and it's relationship with it's contained viewControllers.
Basically you don't want your tabBarController to be embedded in that Nav Controller. Instead, each contained viewController that wants to push on should be embedded in it's own Nav Controller. So in your case you would at least do that for your first tab's tableViewController.
I have a Storyboard with one main ViewController. This ViewController is a Tab Bar controller, with 5 buttons. Let's focus on the two first
The 1st button does a segue to a UINavigationController. Working fine and shows UIVC1. From here, I can push UIVC2. Fine too.
I've made a segue from the main UITabBarController to UIVC2. It even shows the Tab Bar Item, in Storyboard editor. But it doesn't show up in the simulator.
So, can how can I show in my second button o the UITabBarController a UIViewController that I want to "recycle"?
Thanks
I want to have a UIView inside of a NavigationController that has 4 buttons. Clicking on any of these 4 buttons will push a UITabBarController that contains a NavigationController with a respective UIView.
Is this possible? Tweetie seems to do something similar.
On my application, I have a tab bar view controller, then inside of that, I have navigation controllers going to individual views in my interface builder. I believe if you just copy this format, it will work.(-> means connected)
Tab Bar View Controller->4 separate Navigation Controller->ui views
I hope this helps