我正在尝试实现AMScrollingNavbar。我已经通过吊舱安装了它,没有错误出现。我遵循了所有自述文件和演示程序。 AMScrollingNavbar不起作用。什么都没发生。有谁能够帮助我?
Main.Storyboard
最佳答案
按照此步骤您将获得结果
步骤1:-在安装Pod之后,将“ ScrollingNavigationController”分配给导航控制器类
步骤2:-viewdidAppear()方法调用
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
}
}
步骤3:-ScrollingNavigationControllerDelegate方法调用
extension ViewController: ScrollingNavigationControllerDelegate {
func scrollingNavigationController(_ controller: ScrollingNavigationController, willChangeState state: NavigationBarState) {
view.needsUpdateConstraints()
}
}
希望对您有帮助!!