Swipe gesture in UINavigationBar - ios

I would like to add swipe gesture to UINavigationBar. It is possible? As in figure.

You can do it adding custom view into the navigation bar. After adding custom view into the navigation bar add gesture recognisers to it and change x-axis accordingly. Here is some useful resources about how to add custom or built-in view into the navigation bar. add segmented control to navigation bar
Custom segmented view framework : UIScrollSlidingPage

Related

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.

Is it possible to add view behind navigation bar in UITableViewController

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.

Swipe NavigationBar horizontally?

I want to create a UINavigationBar like the following:
I should be able to swipe the icons horizontally. If I swipe to the left I get this:
I cannot use a swipe gesture recognizer because the swipe event is only fired when the swipe ends. I need to capture each position of the swipe gesture to change the content below the navigation bar appropriately.
How can I do that?
What you describe is a pan gesture, not a swipe. You can add code that interprets the movement of the pan as if it's a swipe.
You can do it by customize your own navigation bar. Like inherit uiview and add swipe gesture in it to handle user's swipe. And you will still have to use UINavigationController but hide its navigation bar. Leave your "customized navigation bar" in the place.
And you can find lots code in github.
Hide default navigationbar. Create scrollview with all icons which you want to add in Navigation bar. Add that scrollview in window. So, you can display same in all screens of application.

Hiding navigation bar with a segmented control right under the bar

Here's the set up
Navigation Bar
segmented control
Table view
I know in iOS 8 there is the navigationBar.hidesOnSwipe function that works wonders.
Is there a way, perhaps using autolayout, to also hide the segmented control as the navigationBar hides as well without writing a custom function to handle this?
Also, when I make the following setup in a storyboard, swiping the table view does not hide the navigation bar but swiping the segmented control does. But when I turn .hidesOnTap, the navigationBar hides and pulls the segmentedcontrol up
Thanks in advance

Resources