Change location of Navigation Bar - ios

When using the Navigation Controller it creates a new Navigation Bar on my first view controller. Intead of that bar being at the top of my screen I would like it to be on bottom. Is this possible? If not can I switch to using a different Nav Bar?

Navigation Bars are always at the top of view controllers, and cannot be moved. You could explore a TabBar or ToolBar though, depending on what you want.

Navigation Bar always appear on the top of your UIViewController when embedded in a UINavigationController. You cannot move it to any other position.
Still if you want to achieve such a requirement,
Hide the default UINavigationBar
self.navigationController?.navigationBar.isHidden = true
Create a custom UIView of same height(44) as the UINavigationBar and pin it to the bottom of your controller.

Related

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?

How to make tab bar lay over content in Swift?

I want my tab bar to be translucent and blur the content behind it, but when I set its color to clear color it turns black instead. Currently I have my tab bar created programmatically in the app delegate. I made a class function called getTabBarController and configured my tab bar in there, and I call it in app delegate to return the tab bar. At last, I write
let vc = TabBarInitializer.getTabBarController()
self.window!.rootViewController = vc. Am I creating my tab bar incorrectly? How do I make the tab bar be on top of my content so that the translucent effect works?
You have place view or content behind tabbar which you have to show instead of black.
So when tab transparent, view behind the tabbar become visible.

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.

UIViewController under bottom bar

My ViewController is embed in a UINavigationController. I have a translucent bottom bar (toolbar), and I want my ViewController to expand under the toolbar.
I checked Under Bottom Bars in Storyboard, in both the UINavigationController and the ViewController. But the ViewController still don't extend under bottom bar.
Any Ideas ? Thanks
That is the normal behavior. If the UIViewController's view would extend below the bottom bar, that portion would be inaccessible to the user. I suggest you add a semi-transparent view to the bottom instead of the default bar, in your case.

Resources