AMScrollingNavbar icon indicating copy to clipboard operation
AMScrollingNavbar copied to clipboard

How to keep nav collapsed / expanded with its original status when back?

Open aloveric opened this issue 8 years ago • 8 comments
trafficstars

img_0827

aloveric avatar Aug 17 '17 09:08 aloveric

Hi @aloveric I'm not sure I fully understand, can you elaborate a bit more?

andreamazz avatar Aug 30 '17 15:08 andreamazz

@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

pablogeek avatar Sep 04 '18 20:09 pablogeek

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 avatar Sep 05 '18 13:09 andreamazz

@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

pablogeek avatar Sep 05 '18 15:09 pablogeek

@andreamazz any news on this? thanks!

pablogeek avatar Sep 12 '18 08:09 pablogeek

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.

andreamazz avatar Sep 12 '18 09:09 andreamazz

Screw it, I'll have to rewrite part of the state handling, it's well overdue. I'll keep you posted.

andreamazz avatar Sep 12 '18 14:09 andreamazz

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

andreamazz avatar Sep 12 '18 15:09 andreamazz