Is it possible to add view behind navigation bar in UITableViewController - ios

I wonder if its possible to add a view under the navigation bar in a UITableViewController?
What I would like to do is to add a view under the navigation bar in my UITableViewController so that I can add a search input / filter button to that view. But I want the view to have a fixed position under the navigation bar so that I can hide the navigationbar+view when swiping.
Right now storyboard only lets me add a view in the UITableViewController. And the new view is also swipeable. And the loading indicator shows up above the view when you swipe down.

Related

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

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.

How to hide navigation bar on scroll except when at the top of the screen

I have a UIViewController that contains a UICollectionView pinned to all edges of the view. This view controller is inside a UINavigationController.
I want to gradually hide the navigation bar as I scroll down in the collection view. At the point that I have scrolled the distance of the height of the nav bar, the nav bar should be completely hidden. If I scroll back up it should gradually show the nav bar.
I have tried all the open source navigation bars on github, but none of them work correctly with iOS 12.
How can I achieve this?
UICollectionView is a subclass of UIScrollView and therefore you have access to its scrollViewDidScroll delegate method. Your UIViewController is also owned by its navigation controller, so you can create an instance property in the view controller, like navigationDelegate: UINavigationController?, that will act as a delegate. In the navigation controller, set that property equal to self and manipulate the nav bar however you want through the scroll delegate. Absolutely no need for third-party scripting for something this standard and basic.

Change location of Navigation Bar

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.

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