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..