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
Related
I'm working on iOS application in Swift and I'm showing a table views in Navigation Controller with a Navigation bar.
I'd like to implemented the same "Toolbar experience" as the Files app does. (see attached image) in order to present additional options/buttons without cluttering the screen (for UX purposes mostly).
I could not find anything related, expect for workaround with toolbar on top, but it does not work as part of the navigation bar, meaning that after navigation that toolbar is no following the navigation bar but instead stays on the previous controller.
The ideal behavior is:
to expand when scrolling down (requires table view to be scrolled to top) and to collapse when scrolling down.
to keep the toolbar attached to the navigation bar on navigation (push & pop)
In the screenshot, the toolbar is showing additional options (under the search bar). I'd very much like to do the same.
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
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 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.
As per the picture below, part of the TableView is appearing behind the Navigation Bar.
I had been ignoring it, thinking it was just the way the storyboard drew things because it looks ok in the app. But it can be problematic - sometimes, to select the cell behind the Navigation Bar, one needs to use the Document Outline.
Is that just how it goes? Or is there a way to get Xcode to draw things properly?
It looks like you have selected a translucent navigation bar which will not push down other subviews. Try using the standard or black navigation bar. It probably looks fine in the app because your navigation controller using the non-translucent bar.