Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container navigation controller breaks bar #396

Open
markst opened this issue Aug 13, 2020 · 3 comments
Open

Container navigation controller breaks bar #396

markst opened this issue Aug 13, 2020 · 3 comments

Comments

@markst
Copy link

markst commented Aug 13, 2020

Seems that if I use a navigation controller as a child view controller, the scroll does not appear to work as expected:

Screen Capture on 2020-08-14 at 09-40-06-2

CHECKOUT OPTIONS:
  AMScrollingNavbar:
    :commit: 37743f772b6a5e1328285d295b38cc400ff82d1e
    :git: https://github.com/andreamazz/AMScrollingNavbar.git
@markst
Copy link
Author

markst commented Aug 13, 2020

The statusBarHeight could be the culprit here. If I replace the height with:

var statusBarHeight: CGFloat { return 0.0 }

The bar does behave how we like, however returning with the bar visible seems to break again:

@markst
Copy link
Author

markst commented Aug 14, 2020

Actually it seems that navigationController resolves to nil upon viewDidDisappear which results in stopFollowingScrollView() not completing. Not sure if this is a iOS 13 change or fact I'm using contained navigation controller. Also wonder if scrollableView should be a weak reference.

So a fix to second issue is to stop following on willDisappear:

override func viewWillDisappear(_ animated: Bool) {
  super.viewWillDisappear(animated)

  if let navigationController = navigationController as? ScrollingNavigationController {
    navigationController.showNavbar(animated: true)
    navigationController.stopFollowingScrollView()
  }
}

@andreamazz
Copy link
Owner

Hi @markst
Thanks for the detective work. I reckon that the issues are related to the contained navigation, it's something that I never considered while building the lib, so I expect issues.

markst added a commit to markst/AMScrollingNavbar that referenced this issue Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants