Hide the Navigation Bar on Scroll.

Assumption:
I assume you have embedded UINavigationBar inside your Apple iOS app on Storyboard.

If you want to mimic the behaviour of the Apple Safari iOS App, such as hiding the navigation bar on the scroll, you can do it in just a single line of code without any hassle.

You have to add the following code in your View Controller’s viewDidAppear function where you have added UINavigationBar in the Storyboard:

navigationController?.hidesBarsOnSwipe = true

Now your viewDidAppear function will look like this:

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
navigationController?.hidesBarsOnSwipe = true
}

Hope it helps,

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Leave a Reply