Home > Software engineering >  How to scroll up and navigations bar while scrolling up and need to display while scrolling down
How to scroll up and navigations bar while scrolling up and need to display while scrolling down

Time:07-19

I need my Navigation bar to be scroll up and down while tableview is scrolling up and down.

CodePudding user response:

func scrollViewDidScroll(_ scrollView: UIScrollView) {
        let defaultOffset = view.safeAreaInsets.top
        let offset = scrollView.contentOffset.y   defaultOffset
        
        navigationController?.navigationBar.transform = .init(translationX: 0, y: min(0, -offset))
    }

It should work and I got this problem once, so this code helped me...Might it works for you too..

  • Related