Search code examples
swiftxcodescrolluinavigationcontrollerinstallation

AMScrollingNavbar does not work. Nothing happens


I'm trying to implement AMScrollingNavbar. I already installed it by the pod, no error appears. I followed all the Readme and Demo procedures. AMScrollingNavbar does not work. Nothing happens. Can anybody help me?

Main.Storyboard


Solution

  • Follow this step you will get result

    Step1:- after install pod assign "ScrollingNavigationController" is class to navigation controller

    Step2:- viewdidAppear() Method call

    override func viewDidAppear(_ animated: Bool) {
                super.viewDidAppear(animated)
                if let navigationController = self.navigationController as? ScrollingNavigationController {
                    navigationController.followScrollView(tableview, delay: 0.0, followers: [NavigationBarFollower(view: view, direction: .scrollUp)])
                    navigationController.scrollingNavbarDelegate = self
                }
            }
    

    Step3:- ScrollingNavigationControllerDelegate method call

    extension ViewController: ScrollingNavigationControllerDelegate {
        func scrollingNavigationController(_ controller: ScrollingNavigationController, willChangeState state: NavigationBarState) {
            view.needsUpdateConstraints()
        }
    }
    

    Hope it's Helps to you.!!