How to segue to view controller without the tab bar disappearing from the main view - ios

I need to segue to another UIViewController from my TabBarController without the tab bar disappearing from the bottom of the view.
As you can see in the picture, I want to segue to the colored view when pressing the red button from tab bar controller with the tab bar still displayed at the bottom of the view.
enter image description here

Set each of your tab roots to be a UINativagationController. Then set the current UIViewControllers as the roots of the navs. Then you can segue as much as you want and the tabbar will remain on the bottom.
e.g.
like the bottom flow, you can add another UIViewControllers to the right again.

Related

Put the Navbar fixed while move between tabs

I use the same NavBar in all the views of TabBar, right now I have an Initial TabBarController with five NavigationController and each one with its ViewController.
The thing is that when selecting any section in the TabBar the hole screen, including the NavBar, moves to the selected section.
I need the Navbar and Tabbar to be fixed and only the content in the middle to move when tap to go to some screen.
Hope the description of the problem is clear.
Any ideas what i can do to replicate that behavior?? Thanks!
The reason that is happening is because each tab/view has it's own NavigationController. Instead you need to share one NavigationController with all of the views so that the NavBar isn't a new one every single time
Navigation bar is a part of the navigation controller's view. If you have separate navigation controllers, you essentially have those many navigation bars.
If you just want a single navigation bar / controller and control the content with a bottom bar, you can simply use a toolbar / tabbar (without tabbarcontroller) at the bottom, to navigate / change content

navigation bar not coming common to both screens

This is my slide menu in cyan color on the left and dark on the right is my actual window having the slide menu. i need a common navigation bar for both of them but i am not getting it.
I have attached my slide menu with a navigation bar "embed in" and which furthure is connected to swrevelviewcontroller. what should i do to get a single top navigation bar in a situation where the slide menu is visible and the screen also.
First go to storyboard select view controller then check properties from right side.
Then after you need to set UIBarButton(menu/back) manually in all view controller as per requirement. Might be your problem will solved.

How to contain UIViewController view between navigation bar and tab bar?

I have created a storyboard layout which contains UIViewControllers within UINavigationControllers which all connect back to a UITabBarController. There is a login page which is not connected to anything (just a UIViewController) which segues into the UITabBarController when the app detects user authentication. You can see what this looks like in the following image:
When I set the translucent property of the Navigation Bar to "false" or "No", the view y origin gets pushed down to the bottom of the Navigation Bar (which is the behavior that I am looking for). However, when I set the translucent property of the Tab Bar to "false" or "No", the Tab Bar DOES become opaque, but the view is not resized to fit between the top and bottom bars. I have unchecked the Extend Edges property for both Under Top Bars and Under Bottom Bars for all UIViewControllers, UINavigationControllers, and the UITabBarController.
When I add subviews programmatically (no auto-layout), the UIViewController's view is still the height of the entire screen, and is only pushed down from the top bar, but not pushed up from the bottom bar. While creating this question, this is the result I got on the simulator (subviews are not even starting below the Navigation Bar):
The layout that I'm trying to achieve is to have the view fit between the Navigation Bar and the Tab Bar so that both bars are opaque and no content goes underneath them. Any ideas or suggestions?
EDIT:
After eliminating individual Navigation Controllers and adding a single one before the TabBar Controller, I'm getting weird behavior including navigation items disappearing and one of my subviews still goes under bottom bar.
EDIT 2:
After doing some research, It seems that having navigation controllers inside each tab is a normal view hierarchy. Unfortunately, I still have not figured out how to limit a view controller's view to be between a navigation bar and a tab bar. Any suggestions?

Adding a Tab Bar to NavigationController using interface builder, not intuitive at all

I have this ViewController as the root view controller. This VC is embed in a navigation controller. So, the navigation controller is the initial controller.
I have worked millions of times with an app like this.
If I want to add buttons to my nav bar I go to the navigation controller, turn on TOP BAR property to translucent navigation bar and now I can add buttons to the nav bar on my view controller.
But this app is different. I need a tab bar at the bottom too. So, I follow the same logic. I go to the navigation bar, turn on BOTTOM BAR property to Translucent Black Tab Bar, a black rectangle appears at the bottom of my view controller and BOOM, I cannot add buttons to it. Same logic, different behaviors.
If I try to add a tab bar to the black rectangle Xcode will not accept.
I want to add this tab bar to the bottom of the view controller and make it translucent, so the collectionView this controller has will be partially visible thru it.
So the question is: what is the purpose of the BOTTOM BAR property of the navigation controller if it will not accept dragging tab bar items to it? How do I add a tab bar to my navigation controller or to its root view controller using this stuff? Or in other words: how do I add a tab bar to the bottom of a view controller that has a collection view covering the whole are and make that tab bar translucent, so I can see the contents of the collection view passing thru...
The bottom bar of a UINnavigationController is a UIToolbar and if shown the navigation controller should automatically adjust the insets of the collectionView (and other scrollView) to make the content appear under them when you scroll.
I've encountered the problem of adding elements to that bar myself and the only way that I've found is to do that in code accessing the toolbar property of your navigation controller and set the items property with your UIBarButtoItems. As you want to make a segmented controller-like component I suggest an item with a custom view.
I can't answer the first question, but as for the second- drag a Tab Bar Controller onto the canvass the same way you would with a new View Controller. Make this new Tab Bar Controller the initial View Controller. CTRL-drag from the Tab Bar Controller to any of the view controllers (or navigation controllers) for which you want a tab bar button. Select "View Controller" as the segue type. The tab bar button for that segue will appear at the bottom of both the Tab Bar Controller and the View Controller itself, and you can change the text or image by clicking it and opening the Identity Inspector.

Can I place a UIView the current Navigation Controller?

How can I place a UIView overtop of a Navigation Controller? Is this possible without making my own custom navigation bar and custom tab bar controller out of UIViews?
Let's say I have a UITabBarController and I want to present a blur view overtop of the entire thing. For the blur view, I'm using the UIVisualEffectView. But i want the blurview to take up the entire screen including the top navigation bar and the bottom tab bar. If I push a new view controller, that will take up the entire screen, but then I can't see through it to what's underneath (the tab bar controller's contents).
I could simply hide the navigation bar and tab bar when I animate in the blur view, but that looks awkward because you see the content in the collectionview shift because the navigation bar is hiding... I'd rather not see that shift in the content when the blurview comes up.
Here's a UITabBarController with stuff in it.
I want a blur view to cover everything and to be able to see through to the entire UITabBarController and the stuff underneath.
One way is to add the UIView as a subview of the key window. See this post for how to get the key window. However, it's generally best to keep to your own view hierarchy, so...
Another way might be to present a new view controller as a fullscreen modal, and apply the blur/transparency to that modal view.

Resources