AMScrollingNavbar
AMScrollingNavbar copied to clipboard
How to keep nav collapsed / expanded with its original status when back?
Hi @aloveric I'm not sure I fully understand, can you elaborate a bit more?
@andreamazz This is also happening to me. You have the navbar collapsed when you tap some cell in your collection view. Then you go back and the Navbar is expanded.
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
self.jaNavigationController?.followScrollView(self.collectionView, delay: 50)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.jaNavigationController?.stopFollowingScrollView(showingNavbar: false)
}
This is my code in the Controller where the UICollectionView is
Hey @pablogeek I've just tested this, and it seems to be working fine. I've pushed a new controller when the navbar is hidden, once I got back it was still collapsed.
@andreamazz This happens when you use present instead of pushViewController
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let mainViewController = storyBoard.instantiateViewController(withIdentifier: "ViewController")
self.present(mainViewController, animated: true, completion: nil)
If I do this, when I dismiss the mainViewController it will show the navbar expanded
@andreamazz any news on this? thanks!
Yeah, UIKit restores the navbar to its full height after a modal presentation, the only thing I can do for now is restore the alpha of its subviews. I can't get it to stay hidden. Any help is welcome.
Screw it, I'll have to rewrite part of the state handling, it's well overdue. I'll keep you posted.
Checkout commit c38950d
There is a slight delay where the navbar is visible, but I really can't do anything about it, that's UIKit being bossy.
Let me know if that works