Cons of using a UIView as a Navigation Bar - ios

In a specific view controller I have content that I need placed in the navigation bar that exceeds the maximum height of the navigation bar. From what I understand since iOS 11 the navigation bar's height cannot be extended.
What are the cons of hiding the navigation bar in this view controller and replacing it with a UIView that looks and behaves like a navigation bar? This way I would be able to fit my custom content.

UINavigationController gives use a lot of default functionality which helps you in the navigation. But if you want to use the UIView in place of navigationBar then you have to write the whole code for each functionality.
No such consequences, when you use UIView in place of UINavigationController/Bar.
You can see what functionality apple offers you https://developer.apple.com/documentation/uikit/uinavigationbar

Related

Increasing UINavigationController navigation bar height in Landscape mode

I have seen too many posts on this but unable to find satisfactory answer to this question. Specifically, I want to increase the height of navigation bar of UINavigationController by around 20 pts when iPhone is in landscape mode (not otherwise), and also set a custom image for it's Background. What I have found so far:
Manipulating frame of UINavigationBar managed by navigation controller,
Hacks such as sizeThatFits along with subclassing UINavigationController -- doesn't work for me in iOS 12 and also it is a kind of hack,
Hide the default navigation bar in UINavigationController and instead replace it with a custom navigation bar. But I don't see any sample code. Any sample code will be appreciated.
Edit: Here is how I want my custom navigation bar to look like that works across UINavigation hierarchy.

UINavigationController with Expandable bar

is there an option to put a custom view in navigation bar? where the view can behave like contacts detail view, where on scrolling the header view gets squeezed or expanded. the back button looks handled natively, which is preferable. I could not see any option in UINavigationController API. am I missing something?
This is probably a custom view that blends in with the navigation bar (looks the same at the point they meet). No special nav bar api's needed. This question talks about how to remove the separator and make it look like the nav bar and underlying view blend together: Separator between navigation bar and view - iOS 7

Fully custom view with animations for UINavigationBar

I want to make a drop-in replacement for UINavigationBar with custom controls and transition animations. When I say "custom", I don't mean just tweaking around the edges like changing colours/title or placing custom views inside left/right UIBarButton slots, I mean a completely custom view and animations.
However, customisation capabilities of UINavigationBar are limited, as it has its own opaque internal hierarchy of views, which is ill-advised to tamper with.
The question is, is there any way to have a replacement for the navigation bar without having to also rewrite UINavigationController?
I'm also open to alternatives where the stock navigation bar is completely hidden and a custom navigation bar animates alongside pop/push transition animations.

Best approach for creating this custom UINavigationbar ios

I am creating a UINavigationBar that will expand and contract in various states. The top image is when it is in a contracted state with a transparent background. The lower image represents when it has expanded with a background and search bar. As the user scrolls down the nav bar background would animate in and expose the search field.
Can someone suggest the best way to build this?
So far I've explored subclassing the UINavigationBar, but I've been having a really tough time with the placement of the items within the nav bar or hooking that view up to a xib. I've also see examples where the extended content is just a UIview anchored to the top of the view controller top margin, but then I'm splitting the appearance of my nav into two views which will make the animation problematic.
According to the answer to UISegmentedControl below UINavigationbar in iOS 7 it can be accomplished using a UIToolBar and some delegate methods.
You might have to tweak it a little bit however, to fit the search bar that you want to include.

Achieving iOS 7.1 UINavigationBar blur

I have another UIView under the navigation bar like this.
I want the slight blur of the navigation bar for that UIView too. Currently I have its alpha value reduced but it doesn't give the desired effect as you can see.
How can I get the frosty look of the navigation bar for the UIView as well? I'm on iOS 7.1.
Don't use a UIView - you will never achieve a consistent result with the navigation bar.
Use a UIToolbar and place it below the navigation bar. Set the delegate of the toolbar to your view controller and implement positionForBar: to return UIBarPositionTop or UIBarPositionTopAttached. You can then add all the subviews you have in your view to the toolbar.
you can use UIToolbar, it's the quickest way.
If you want to customize it, you have to use 3rd library like ILTrasparentView, FXBlurView ...

Resources