iOS Navigation bar is getting hided when scrolling (is kind of scrolling too), regardless it is outside the scroll view - ios

I'm having issues with the navigation bar, I want to set a view controller where there is a scroll view with its content, but I'm having a weird behavior that when I scroll down the navigation bar hides kind of scrolling with the scroll view but the navigation bar is not inside that.
My Scroll view has a vertical spacing to the top to avoid going upper that I want and hiding the navigation bar but it still happens.
Any help will be appreciated.

Have you tried to set hidesBarsOnSwipe = false for the navigation contrller.
More info from Apple api reference

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.

Adjust Navigation Bar width inside NavigationController

I am trying to implement a horizontal scrolling table view. I was able to accomplish this with the following layout. I have a ScrollView which contains a Container View which points to my NavigationController. Since I made the Container View wider than the ScrollView, the table is able to scroll left to right as expected.
The problem I am having is resizing the Navigation Bar's width as I do not want to have to scroll to view the Navigation Bar's title. I tried explicitly setting the width property of the Navigation Bar in ViewDidAppear however it keeps getting resized to the actual width of the table view. Is there any way I can do this without having to create my own custom view that mimics that Navigation Bar?
I ended up creating my own navigation bar that is placed on top of the actual integrated table view navigation bar.

scroll up tableview to hide half of navigation bar and the whole table gets offset

I'm using a UITableViewController embedded in a navigation controller, I've checked the "hide bars on swipe" for the navigation controller in the storyboard. No crazy code, scrollview functions are not overridden, didn't write any code that would offset any views.
When I scroll up the tableview a tiny bit and release it when the navigation bar is half hidden, the whole table gets offset and it's off screen (sometimes the top left corner of the table is visible), then if I scroll up the table view a bit, it's back to its normal position, if I check "adjust scroll view insets" in the storyboard, the whole screen flashes black.
Has anyone encountered the same problem?
p.s. I'm using Xcode 9 beta with iOS 10.3, not sure if this has anything to do with it.
EDIT:
Scroll navigation bar half way
The view after releasing
So I created a new set of TableviewController and NavigationController, and tested it step by step by adding changes to it, it turned out that I had set my navigation bar to be translucent in the storyboard, once I unchecked it the issue was resolved. There's still an unwanted bounce effect if I release the navigation bar at half hidden position, which appears to be the view adjusting the offset, but it's way better than what it was like.
P.S. make sure "Adjust scroll view insets" is checked.
EDIT:
Turns out setting extendedLayoutIncludesOpaqueBars to True also resolves this issue, if you want to keep the navigation bar opaque.

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?

UIPageController inside UINavigationController is offset from the top?

This a little bit wierd i have made UIPageController that works and everything is fine. But when i put it inside UINavigationController, it offset from the for status bar. Than i swipe up on that screen it positions itself right and everything is ok. I don't really understand what is happening. Here are the images
try setting adjustScrollViewInsets to false on UIPageController.
This is the property that determines whether the system should automatically add inset to a UIScrollView in your view controller's view hierarchy when it is being displayed behind transparent bars (here , the navigation bar). What happened here is that the system assumed the bounds of the page controller overlaps with that of the nav bar and so it adds insets so that the view's contents is fully visible and is not obscured by the nav bar. But in this case it is wrong since it seems your page controller's bounds starts at the bottom edge of the nav bar.
I think you can also set the nav bar as opaque to disable the automatic adding of insets.

Resources